Pārlūkot izejas kodu

p2p: fix a dialing race in the throttler

Péter Szilágyi 10 gadi atpakaļ
vecāks
revīzija
29fef349ef
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      p2p/server.go

+ 1 - 1
p2p/server.go

@@ -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{}{}
 		}()
 	}