提交 fd3e1061 编写于 作者: F Felix Lange

p2p: handle disconnect before protocol handshake

上级 cf754b94
......@@ -255,6 +255,13 @@ func readProtocolHandshake(p *Peer, rw MsgReadWriter) error {
if err != nil {
return err
}
if msg.Code == discMsg {
// disconnect before protocol handshake is valid according to the
// spec and we send it ourself if Server.addPeer fails.
var reason DiscReason
rlp.Decode(msg.Payload, &reason)
return discRequestedError(reason)
}
if msg.Code != handshakeMsg {
return newPeerError(errProtocolBreach, "expected handshake, got %x", msg.Code)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册