Fix peer handshake timeout error message
Use proper format verb for handshakeTimeout
This commit is contained in:
parent
d4b042dc19
commit
ec1a77dccb
11
peer.go
11
peer.go
@ -46,6 +46,9 @@ const (
|
|||||||
// writeMessageTimeout is the timeout used when writing a message to peer.
|
// writeMessageTimeout is the timeout used when writing a message to peer.
|
||||||
writeMessageTimeout = 50 * time.Second
|
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
|
// outgoingQueueLen is the buffer size of the channel which houses
|
||||||
// messages to be sent across the wire, requested by objects outside
|
// messages to be sent across the wire, requested by objects outside
|
||||||
// this struct.
|
// this struct.
|
||||||
@ -269,10 +272,10 @@ func (p *peer) Start() error {
|
|||||||
|
|
||||||
select {
|
select {
|
||||||
// In order to avoid blocking indefinitely, we'll give the other peer
|
// 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.
|
// an upper timeout to respond before we bail out early.
|
||||||
case <-time.After(time.Second * 15):
|
case <-time.After(handshakeTimeout):
|
||||||
return fmt.Errorf("peer did not complete handshake within 5 " +
|
return fmt.Errorf("peer did not complete handshake within %v",
|
||||||
"seconds")
|
handshakeTimeout)
|
||||||
case err := <-readErr:
|
case err := <-readErr:
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to read init msg: %v", err)
|
return fmt.Errorf("unable to read init msg: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user