p2p: fix a dialing race in the throttler

pull/840/head
Péter Szilágyi 10 years ago
parent 3953bf0031
commit 29fef349ef
  1. 2
      p2p/server.go

@ -422,13 +422,13 @@ func (srv *Server) dialLoop() {
} }
// Request a dial slot to prevent CPU exhaustion // Request a dial slot to prevent CPU exhaustion
<-slots <-slots
defer func() { slots <- struct{}{} }()
dialing[dest.ID] = true dialing[dest.ID] = true
srv.peerWG.Add(1) srv.peerWG.Add(1)
go func() { go func() {
srv.dialNode(dest) srv.dialNode(dest)
dialed <- dest dialed <- dest
slots <- struct{}{}
}() }()
} }

Loading…
Cancel
Save