From 9423401d73562b2a55398559a9d21af75210d955 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 9 Dec 2014 13:39:56 +0100 Subject: p2p: fix decoding of disconnect reason (fixes #200) --- p2p/protocol.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'p2p/protocol.go') diff --git a/p2p/protocol.go b/p2p/protocol.go index 28eab87cd..5af586f13 100644 --- a/p2p/protocol.go +++ b/p2p/protocol.go @@ -154,11 +154,11 @@ func (bp *baseProtocol) handle(rw MsgReadWriter) error { return newPeerError(errProtocolBreach, "extra handshake received") case discMsg: - var reason DiscReason + var reason [1]DiscReason if err := msg.Decode(&reason); err != nil { return err } - bp.peer.Disconnect(reason) + bp.peer.Disconnect(reason[0]) return nil case pingMsg: -- cgit v1.2.3 From f0f672777866a524c36e767a6c313f93f574dd8c Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 12 Dec 2014 11:58:39 +0100 Subject: p2p: use an error type for disconnect requests Test-tastic. --- p2p/protocol.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'p2p/protocol.go') diff --git a/p2p/protocol.go b/p2p/protocol.go index 5af586f13..3f52205f5 100644 --- a/p2p/protocol.go +++ b/p2p/protocol.go @@ -158,8 +158,7 @@ func (bp *baseProtocol) handle(rw MsgReadWriter) error { if err := msg.Decode(&reason); err != nil { return err } - bp.peer.Disconnect(reason[0]) - return nil + return discRequestedError(reason[0]) case pingMsg: return bp.rw.EncodeMsg(pongMsg) -- cgit v1.2.3