Skip to content

Commit 2f389ce

Browse files
simplify starting of the dialWorkerLoop
1 parent 9adcf8f commit 2f389ce

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

p2p/net/swarm/dial_sync.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (ds *DialSync) getActiveDial(p peer.ID) (*activeDial, error) {
9393
reqch: make(chan dialRequest),
9494
ds: ds,
9595
}
96-
ds.dialWorker(p, actd.reqch)
96+
go ds.dialWorker(p, actd.reqch)
9797
ds.dials[p] = actd
9898
}
9999

p2p/net/swarm/swarm.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func NewSwarm(ctx context.Context, local peer.ID, peers peerstore.Peerstore, bwc
122122
}
123123
}
124124

125-
s.dsync = newDialSync(s.startDialWorker)
125+
s.dsync = newDialSync(s.dialWorkerLoop)
126126
s.limiter = newDialLimiter(s.dialAddr)
127127
s.proc = goprocessctx.WithContext(ctx)
128128
s.ctx = goprocessctx.OnClosingContext(s.proc)

p2p/net/swarm/swarm_dial.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,7 @@ type dialResponse struct {
294294
err error
295295
}
296296

297-
// startDialWorker starts an active dial goroutine that synchronizes and executes concurrent dials to a single peer
298-
func (s *Swarm) startDialWorker(p peer.ID, reqch <-chan dialRequest) {
299-
go s.dialWorkerLoop(p, reqch)
300-
}
301-
297+
// dialWorkerLoop synchronizes and executes concurrent dials to a single peer
302298
func (s *Swarm) dialWorkerLoop(p peer.ID, reqch <-chan dialRequest) {
303299
defer s.limiter.clearAllPeerDials(p)
304300

0 commit comments

Comments
 (0)