Skip to content
This repository was archived by the owner on May 26, 2022. It is now read-only.

Commit 9494031

Browse files
simplify starting of the dialWorkerLoop
1 parent dbaeab9 commit 9494031

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

dial_sync.go

Lines changed: 1 addition & 1 deletion
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

swarm.go

Lines changed: 1 addition & 1 deletion
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, isFdConsumingAddr)
127127
s.proc = goprocessctx.WithContext(ctx)
128128
s.ctx = goprocessctx.OnClosingContext(s.proc)

swarm_dial.go

Lines changed: 1 addition & 5 deletions
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)