aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/rlpx.go
diff options
context:
space:
mode:
authorJanos Guljas <janos@resenje.org>2018-02-23 01:50:47 +0800
committerJanos Guljas <janos@resenje.org>2018-02-23 01:51:34 +0800
commit6a9730edaa3c398ef1e9fe084f9b16de4d3ef78e (patch)
tree442ae3e5d75fa5418b362474754d319a7fdfa8f0 /p2p/rlpx.go
parenta3a07350dcef0ba39829a20d8ddba4bd3463d293 (diff)
parent221486a29109803286c1448426d6180ef5024cf0 (diff)
downloaddexon-6a9730edaa3c398ef1e9fe084f9b16de4d3ef78e.tar
dexon-6a9730edaa3c398ef1e9fe084f9b16de4d3ef78e.tar.gz
dexon-6a9730edaa3c398ef1e9fe084f9b16de4d3ef78e.tar.bz2
dexon-6a9730edaa3c398ef1e9fe084f9b16de4d3ef78e.tar.lz
dexon-6a9730edaa3c398ef1e9fe084f9b16de4d3ef78e.tar.xz
dexon-6a9730edaa3c398ef1e9fe084f9b16de4d3ef78e.tar.zst
dexon-6a9730edaa3c398ef1e9fe084f9b16de4d3ef78e.zip
swarm, cmd/swarm: Merge branch 'master' into multiple-ens-endpoints
Diffstat (limited to 'p2p/rlpx.go')
-rw-r--r--p2p/rlpx.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/p2p/rlpx.go b/p2p/rlpx.go
index 24037ecc1..e65a0b604 100644
--- a/p2p/rlpx.go
+++ b/p2p/rlpx.go
@@ -108,8 +108,14 @@ func (t *rlpx) close(err error) {
// Tell the remote end why we're disconnecting if possible.
if t.rw != nil {
if r, ok := err.(DiscReason); ok && r != DiscNetworkError {
- t.fd.SetWriteDeadline(time.Now().Add(discWriteTimeout))
- SendItems(t.rw, discMsg, r)
+ // rlpx tries to send DiscReason to disconnected peer
+ // if the connection is net.Pipe (in-memory simulation)
+ // it hangs forever, since net.Pipe does not implement
+ // a write deadline. Because of this only try to send
+ // the disconnect reason message if there is no error.
+ if err := t.fd.SetWriteDeadline(time.Now().Add(discWriteTimeout)); err == nil {
+ SendItems(t.rw, discMsg, r)
+ }
}
}
t.fd.Close()