]> granicus.if.org Git - transmission/commitdiff
(trunk libT) Don't log two "errors" we expect to see from time-to-time.
authorErick Turnquist <jhujhiti@adjectivism.org>
Sat, 20 Dec 2008 08:51:32 +0000 (08:51 +0000)
committerErick Turnquist <jhujhiti@adjectivism.org>
Sat, 20 Dec 2008 08:51:32 +0000 (08:51 +0000)
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.

libtransmission/fdlimit.c
libtransmission/net.c

index a4423efe1976a38f84cc5217d75c8b1b7d23b340..2845284bbdca0cafa8625ec38898febeed8ac394 100644 (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;
index 2a61ae76ad18ef935902e08bfc2e21bd43692ea7..e96acb5eb8a6db86b74a562171958e8ce7cdbf1e 100644 (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;
     }