aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/handshake.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-04-08 23:37:11 +0800
committerFelix Lange <fjl@twurst.com>2015-04-10 19:26:27 +0800
commitf1d710af006d7e9ed6046ab410976bd20c1e3c97 (patch)
treef7a6b948d41d1554bdf935d2854442c58b414d63 /p2p/handshake.go
parent22d1f0faf1fcb20063b719f8fc70534e268485b6 (diff)
downloaddexon-f1d710af006d7e9ed6046ab410976bd20c1e3c97.tar
dexon-f1d710af006d7e9ed6046ab410976bd20c1e3c97.tar.gz
dexon-f1d710af006d7e9ed6046ab410976bd20c1e3c97.tar.bz2
dexon-f1d710af006d7e9ed6046ab410976bd20c1e3c97.tar.lz
dexon-f1d710af006d7e9ed6046ab410976bd20c1e3c97.tar.xz
dexon-f1d710af006d7e9ed6046ab410976bd20c1e3c97.tar.zst
dexon-f1d710af006d7e9ed6046ab410976bd20c1e3c97.zip
p2p: fix Peer shutdown deadlocks
There were multiple synchronization issues in the disconnect handling, all caused by the odd special-casing of Peer.readLoop errors. Remove the special handling of read errors and make readLoop part of the Peer WaitGroup. Thanks to @Gustav-Simonsson for pointing at arrows in a diagram and playing rubber-duck.
Diffstat (limited to 'p2p/handshake.go')
-rw-r--r--p2p/handshake.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/p2p/handshake.go b/p2p/handshake.go
index 031064407..5a259cd76 100644
--- a/p2p/handshake.go
+++ b/p2p/handshake.go
@@ -409,7 +409,7 @@ func readProtocolHandshake(r MsgReader, our *protoHandshake) (*protoHandshake, e
// spec and we send it ourself if Server.addPeer fails.
var reason DiscReason
rlp.Decode(msg.Payload, &reason)
- return nil, discRequestedError(reason)
+ return nil, reason
}
if msg.Code != handshakeMsg {
return nil, fmt.Errorf("expected handshake, got %x", msg.Code)