From 2729d3c29136cc4dbd9d65aeb14e52c9e7194ab0 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Fri, 18 Feb 2011 00:43:43 +0000 Subject: [PATCH] Don't mark atoms as non-uTP unless we failed to connect. --- libtransmission/handshake.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libtransmission/handshake.c b/libtransmission/handshake.c index 3b2bad00a..85cfdf815 100644 --- a/libtransmission/handshake.c +++ b/libtransmission/handshake.c @@ -1128,6 +1128,7 @@ gotError( tr_peerIo * io, short what, void * vhandshake ) { + int errcode = errno; tr_handshake * handshake = vhandshake; if( io->utp_socket && !io->isIncoming && handshake->state == AWAITING_YB ) { @@ -1137,14 +1138,13 @@ gotError( tr_peerIo * io, tr_torrentFindFromHash( handshake->session, tr_peerIoGetTorrentHash( io ) ) : NULL; - if( tor ) { + /* Don't mark a peer as non-uTP unless it's really a connect failure. */ + if( tor && ( errcode == ETIMEDOUT || errcode == ECONNREFUSED ) ) { tr_torrentLock( tor ); tr_peerMgrSetUtpFailed( tor, tr_peerIoGetAddress( io, NULL ), TRUE ); tr_torrentUnlock( tor ); - } else { - tr_nerr( "UTP", "Eek -- couldn't find torrent for outgoing I/O." ); } if( !tr_peerIoReconnect( handshake->io ) ) {