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

Commit

Permalink
simplify starting of the dialWorkerLoop
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Aug 27, 2021
1 parent 62d5d6f commit 1bf84f7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dial_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (ds *DialSync) getActiveDial(p peer.ID) (*activeDial, error) {
reqch: make(chan dialRequest),
ds: ds,
}
ds.dialWorker(p, actd.reqch)
go ds.dialWorker(p, actd.reqch)
ds.dials[p] = actd
}

Expand Down
2 changes: 1 addition & 1 deletion swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func NewSwarm(ctx context.Context, local peer.ID, peers peerstore.Peerstore, bwc
}
}

s.dsync = newDialSync(s.startDialWorker)
s.dsync = newDialSync(s.dialWorkerLoop)
s.limiter = newDialLimiter(s.dialAddr)
s.proc = goprocessctx.WithContext(ctx)
s.ctx = goprocessctx.OnClosingContext(s.proc)
Expand Down
6 changes: 1 addition & 5 deletions swarm_dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,7 @@ type dialResponse struct {
err error
}

// startDialWorker starts an active dial goroutine that synchronizes and executes concurrent dials to a single peer
func (s *Swarm) startDialWorker(p peer.ID, reqch <-chan dialRequest) {
go s.dialWorkerLoop(p, reqch)
}

// dialWorkerLoop synchronizes and executes concurrent dials to a single peer
func (s *Swarm) dialWorkerLoop(p peer.ID, reqch <-chan dialRequest) {
defer s.limiter.clearAllPeerDials(p)

Expand Down

0 comments on commit 1bf84f7

Please sign in to comment.