(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.
This commit is contained in:
Erick Turnquist
2008-12-20 08:51:32 +00:00
parent 49b84fb805
commit a68764fcba
2 changed files with 7 additions and 2 deletions
+3
View File
@@ -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;
+4 -2
View File
@@ -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;
}