From 4fead22cd272f24bc6d56ab6a1740838f2ed4409 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Sun, 16 Nov 2014 13:31:11 -0600 Subject: [PATCH] Use more generic net error type to detect timeouts --- client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client.go b/client.go index 89a7bffb..1ba632ae 100644 --- a/client.go +++ b/client.go @@ -401,10 +401,10 @@ func (me *Client) initiateConn(peer Peer, t *torrent) { me.openNewConns() }() + if netErr, ok := err.(net.Error); ok && netErr.Timeout() { + return + } if netOpErr, ok := err.(*net.OpError); ok { - if netOpErr.Timeout() { - return - } switch netOpErr.Err { case syscall.ECONNREFUSED, syscall.EHOSTUNREACH: return