aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-04-30 20:21:09 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-05-07 20:22:08 +0800
commit29fef349efd87dcca76b0593e6b68ca9f3ccf2cd (patch)
tree560f5f506dac2d264814a7f61544675102ca1b1f /p2p
parent3953bf0031b6b2a4302b333aa65fc8ccaa7d788c (diff)
downloadgo-tangerine-29fef349efd87dcca76b0593e6b68ca9f3ccf2cd.tar.gz
go-tangerine-29fef349efd87dcca76b0593e6b68ca9f3ccf2cd.tar.zst
go-tangerine-29fef349efd87dcca76b0593e6b68ca9f3ccf2cd.zip
p2p: fix a dialing race in the throttler
Diffstat (limited to 'p2p')
-rw-r--r--p2p/server.go2
1 files changed, 1 insertions, 1 deletions
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{}{}
}()
}