Use more generic net error type to detect timeouts

This commit is contained in:
Matt Joiner 2014-11-16 13:31:11 -06:00
parent e37d369864
commit 4fead22cd2
1 changed files with 3 additions and 3 deletions

View File

@ -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