aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/handshake.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-03-04 23:27:37 +0800
committerFelix Lange <fjl@twurst.com>2015-03-04 23:42:00 +0800
commit22659a7feaf4e939a33762c3f83b43d8bec757db (patch)
tree59ae2809af292a79a4f619042ed190b4708d5c2a /p2p/handshake.go
parent6e7e5d5fd56a9a6f73e51239ed6648d76db9650d (diff)
downloaddexon-22659a7feaf4e939a33762c3f83b43d8bec757db.tar
dexon-22659a7feaf4e939a33762c3f83b43d8bec757db.tar.gz
dexon-22659a7feaf4e939a33762c3f83b43d8bec757db.tar.bz2
dexon-22659a7feaf4e939a33762c3f83b43d8bec757db.tar.lz
dexon-22659a7feaf4e939a33762c3f83b43d8bec757db.tar.xz
dexon-22659a7feaf4e939a33762c3f83b43d8bec757db.tar.zst
dexon-22659a7feaf4e939a33762c3f83b43d8bec757db.zip
p2p: restore read/write timeouts
They got lost in the transition to rlpxFrameRW.
Diffstat (limited to 'p2p/handshake.go')
-rw-r--r--p2p/handshake.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/p2p/handshake.go b/p2p/handshake.go
index 3ad25bae4..7fc497517 100644
--- a/p2p/handshake.go
+++ b/p2p/handshake.go
@@ -37,7 +37,7 @@ const (
//
// The MsgReadWriter is usually layered as follows:
//
-// lockedRW (thread-safety for ReadMsg, WriteMsg)
+// netWrapper (I/O timeouts, thread-safe ReadMsg, WriteMsg)
// rlpxFrameRW (message encoding, encryption, authentication)
// bufio.ReadWriter (buffering)
// net.Conn (network I/O)
@@ -83,7 +83,6 @@ func setupInboundConn(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake) (
}
// Run the protocol handshake using authenticated messages.
- // TODO: move buffering setup here (out of newFrameRW)
rw := newRlpxFrameRW(fd, secrets)
rhs, err := readProtocolHandshake(rw, our)
if err != nil {
@@ -96,7 +95,7 @@ func setupInboundConn(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake) (
if err := writeProtocolHandshake(rw, our); err != nil {
return nil, fmt.Errorf("protocol write error: %v", err)
}
- return &conn{&lockedRW{wrapped: rw}, rhs}, nil
+ return &conn{rw, rhs}, nil
}
func setupOutboundConn(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake, dial *discover.Node) (*conn, error) {
@@ -106,7 +105,6 @@ func setupOutboundConn(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake,
}
// Run the protocol handshake using authenticated messages.
- // TODO: move buffering setup here (out of newFrameRW)
rw := newRlpxFrameRW(fd, secrets)
if err := writeProtocolHandshake(rw, our); err != nil {
return nil, fmt.Errorf("protocol write error: %v", err)
@@ -118,7 +116,7 @@ func setupOutboundConn(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake,
if rhs.ID != dial.ID {
return nil, errors.New("dialed node id mismatch")
}
- return &conn{&lockedRW{wrapped: rw}, rhs}, nil
+ return &conn{rw, rhs}, nil
}
// encHandshake contains the state of the encryption handshake.