From 29fef349efd87dcca76b0593e6b68ca9f3ccf2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Thu, 30 Apr 2015 15:21:09 +0300 Subject: [PATCH] p2p: fix a dialing race in the throttler --- p2p/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/p2p/server.go b/p2p/server.go index 5424b5463..16768f920 100644 --- a/p2p/server.go +++ b/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{}{} }() }