p2p: fix a dialing race in the throttler
This commit is contained in:
parent
3953bf0031
commit
29fef349ef
@ -422,13 +422,13 @@ func (srv *Server) dialLoop() {
|
||||
}
|
||||
// Request a dial slot to prevent CPU exhaustion
|
||||
<-slots
|
||||
defer func() { slots <- struct{}{} }()
|
||||
|
||||
dialing[dest.ID] = true
|
||||
srv.peerWG.Add(1)
|
||||
go func() {
|
||||
srv.dialNode(dest)
|
||||
dialed <- dest
|
||||
slots <- struct{}{}
|
||||
}()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user