diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-22 01:18:19 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-22 01:18:19 +0800 |
commit | 7f85608f30a2e34005c8d15566849229c758c2f1 (patch) | |
tree | 7aeb9d8bdfda7ec10ea38688a96ed245028764ad /p2p/handshake.go | |
parent | 09766d1729f7530093aec7e9acd3e5339b2c2028 (diff) | |
parent | fcacfabe1959c4aff6a63cb4e275f65328660601 (diff) | |
download | dexon-7f85608f30a2e34005c8d15566849229c758c2f1.tar dexon-7f85608f30a2e34005c8d15566849229c758c2f1.tar.gz dexon-7f85608f30a2e34005c8d15566849229c758c2f1.tar.bz2 dexon-7f85608f30a2e34005c8d15566849229c758c2f1.tar.lz dexon-7f85608f30a2e34005c8d15566849229c758c2f1.tar.xz dexon-7f85608f30a2e34005c8d15566849229c758c2f1.tar.zst dexon-7f85608f30a2e34005c8d15566849229c758c2f1.zip |
Merge branch 'conversion' into develop
Diffstat (limited to 'p2p/handshake.go')
-rw-r--r-- | p2p/handshake.go | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/p2p/handshake.go b/p2p/handshake.go index 7fc497517..031064407 100644 --- a/p2p/handshake.go +++ b/p2p/handshake.go @@ -92,7 +92,7 @@ func setupInboundConn(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake) ( return nil, errors.New("node ID in protocol handshake does not match encryption handshake") } // TODO: validate that handshake node ID matches - if err := writeProtocolHandshake(rw, our); err != nil { + if err := Send(rw, handshakeMsg, our); err != nil { return nil, fmt.Errorf("protocol write error: %v", err) } return &conn{rw, rhs}, nil @@ -106,7 +106,7 @@ func setupOutboundConn(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake, // Run the protocol handshake using authenticated messages. rw := newRlpxFrameRW(fd, secrets) - if err := writeProtocolHandshake(rw, our); err != nil { + if err := Send(rw, handshakeMsg, our); err != nil { return nil, fmt.Errorf("protocol write error: %v", err) } rhs, err := readProtocolHandshake(rw, our) @@ -398,10 +398,6 @@ func xor(one, other []byte) (xor []byte) { return xor } -func writeProtocolHandshake(w MsgWriter, our *protoHandshake) error { - return EncodeMsg(w, handshakeMsg, our.Version, our.Name, our.Caps, our.ListenPort, our.ID[:]) -} - func readProtocolHandshake(r MsgReader, our *protoHandshake) (*protoHandshake, error) { // read and handle remote handshake msg, err := r.ReadMsg() |