From: Erick Turnquist Date: Sat, 20 Dec 2008 08:51:32 +0000 (+0000) Subject: (trunk libT) Don't log two "errors" we expect to see from time-to-time. X-Git-Tag: 1.60~715 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a68764fcbabae6453744df5347044bc5e0b430b8;p=transmission (trunk libT) Don't log two "errors" we expect to see from time-to-time. EAFNOSUPPORT: On OS X, socket() incorrectly throws EAFNOSUPPORT for certain IP/Port combinations. There is nothing we can do about this. ENETUNREACH: #1606 is evidence that some trackers return IPv6 peers when contacted over IPv4. This code will silently ignore "network unreachable" errors for IPv6 connections. --- diff --git a/libtransmission/fdlimit.c b/libtransmission/fdlimit.c index a4423efe1..2845284bb 100644 --- a/libtransmission/fdlimit.c +++ b/libtransmission/fdlimit.c @@ -459,6 +459,9 @@ tr_fdSocketCreate( int domain, int type ) if( gFd->socketCount < getSocketMax( gFd ) ) if( ( s = socket( domain, type, 0 ) ) < 0 ) { +#ifdef SYS_DARWIN + if( sockerrno != EAFNOSUPPORT ) +#endif tr_err( _( "Couldn't create socket: %s" ), tr_strerror( sockerrno ) ); s = -sockerrno; diff --git a/libtransmission/net.c b/libtransmission/net.c index 2a61ae76a..e96acb5eb 100644 --- a/libtransmission/net.c +++ b/libtransmission/net.c @@ -402,9 +402,11 @@ tr_netOpenTCP( tr_session * session, && ( sockerrno != EINPROGRESS ) ) { int tmperrno; - tr_err( _( "Couldn't connect socket %d to %s, port %d (errno %d - %s)" ), - s, tr_ntop_non_ts( addr ), (int)port, sockerrno, tr_strerror( sockerrno ) ); tmperrno = sockerrno; + if( tmperrno != ENETUNREACH || addr->type == TR_AF_INET ) + tr_err( _( "Couldn't connect socket %d to %s, port %d (errno %d - %s)" ), + s, tr_ntop_non_ts( addr ), (int)port, tmperrno, + tr_strerror( tmperrno ) ); tr_netClose( s ); s = -tmperrno; }