From ec1a77dccb58e3b6f423be6eb79961b7a6c047c7 Mon Sep 17 00:00:00 2001 From: chokoboko <> Date: Fri, 9 Nov 2018 19:58:14 +0200 Subject: [PATCH] Fix peer handshake timeout error message Use proper format verb for handshakeTimeout --- peer.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/peer.go b/peer.go index 63e526210..3cac60f91 100644 --- a/peer.go +++ b/peer.go @@ -46,6 +46,9 @@ const ( // writeMessageTimeout is the timeout used when writing a message to peer. writeMessageTimeout = 50 * time.Second + // handshakeTimeout is the timeout used when waiting for peer init message. + handshakeTimeout = 15 * time.Second + // outgoingQueueLen is the buffer size of the channel which houses // messages to be sent across the wire, requested by objects outside // this struct. @@ -269,10 +272,10 @@ func (p *peer) Start() error { select { // In order to avoid blocking indefinitely, we'll give the other peer - // an upper timeout of 15 seconds to respond before we bail out early. - case <-time.After(time.Second * 15): - return fmt.Errorf("peer did not complete handshake within 5 " + - "seconds") + // an upper timeout to respond before we bail out early. + case <-time.After(handshakeTimeout): + return fmt.Errorf("peer did not complete handshake within %v", + handshakeTimeout) case err := <-readErr: if err != nil { return fmt.Errorf("unable to read init msg: %v", err)