From: Charles Kerr Date: Fri, 8 Aug 2008 22:44:32 +0000 (+0000) Subject: back out the changes from r6415. X-Git-Tag: 1.32~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6937164c9312fb21c0562f13c33557f8c0893ecc;p=transmission back out the changes from r6415. --- diff --git a/libtransmission/peer-io.c b/libtransmission/peer-io.c index 38d51dc7b..c2b463e42 100644 --- a/libtransmission/peer-io.c +++ b/libtransmission/peer-io.c @@ -68,8 +68,6 @@ struct tr_peerIo void * userData; tr_crypto * crypto; - - uint64_t fromPeer; }; /** @@ -539,11 +537,11 @@ tr_peerIoReadBytes( tr_peerIo * io, switch( io->encryptionMode ) { case PEER_ENCRYPTION_NONE: - io->fromPeer += evbuffer_remove( inbuf, bytes, byteCount ); + evbuffer_remove( inbuf, bytes, byteCount ); break; case PEER_ENCRYPTION_RC4: - io->fromPeer += evbuffer_remove( inbuf, bytes, byteCount ); + evbuffer_remove( inbuf, bytes, byteCount ); tr_cryptoDecrypt( io->crypto, byteCount, bytes, bytes ); break; @@ -595,10 +593,3 @@ tr_peerIoGetAge( const tr_peerIo * io ) { return time( NULL ) - io->timeCreated; } - -int64_t -tr_peerIoCountBytesFromPeer( const tr_peerIo * io ) -{ - return io->fromPeer; -} - diff --git a/libtransmission/peer-io.h b/libtransmission/peer-io.h index 953a8271c..fede9c4b9 100644 --- a/libtransmission/peer-io.h +++ b/libtransmission/peer-io.h @@ -178,6 +178,5 @@ void tr_peerIoDrain ( tr_peerIo * io, struct evbuffer * inbuf, size_t byteCount ); -int64_t tr_peerIoCountBytesFromPeer( const tr_peerIo * io ); #endif diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.c index 939ac2cdf..d3622bb13 100644 --- a/libtransmission/peer-mgr.c +++ b/libtransmission/peer-mgr.c @@ -44,7 +44,7 @@ enum RECHOKE_PERIOD_MSEC = (10 * 1000), /* minimum interval for refilling peers' request lists */ - REFILL_PERIOD_MSEC = 500, + REFILL_PERIOD_MSEC = 333, /* when many peers are available, keep idle ones this long */ MIN_UPLOAD_IDLE_SECS = (60 * 3), @@ -965,18 +965,7 @@ myHandshakeDoneCB( tr_handshake * handshake, if( t ) { struct peer_atom * atom = getExistingAtom( t, addr ); if( atom ) - { - /* if we talked but the connection failed, mark a failure - * in the peer's permanent record. if they didn't send - * us anything at all, mark the peer as unreachable. */ - if( tr_peerIoCountBytesFromPeer( io ) ) { - ++atom->numFails; - tordbg( t, "handshake failed; incremented fail count to %d", (int)atom->numFails ); - } else { - tordbg( t, "no data received at all during handshake; marking as unreachable" ); - atom->myflags |= MYFLAG_UNREACHABLE; - } - } + ++atom->numFails; } tr_peerIoFree( io ); @@ -1090,6 +1079,14 @@ tr_peerMgrCompactToPex( const void * compact, size_t n = compactLen / 6; const uint8_t * walk = compact; tr_pex * pex = tr_new0( tr_pex, n ); +if( added_f && strlen(added_f)!=n ) +{ + int i; + const int len = strlen( added_f ); + fprintf( stderr, "compactLen is %d, n is %d, and strlen(added_f) is %d!!!\n", (int)compactLen, (int)n, len ); + for( i=0; i maxWait ) wait = maxWait; if( ( now - atom->time ) < wait ) { - /*tordbg( t, "RECONNECT peer %d (%s) is in its grace period of %d seconds..", - i, tr_peerIoAddrStr(&atom->addr,atom->port), wait );*/ + tordbg( t, "RECONNECT peer %d (%s) is in its grace period of %d seconds..", + i, tr_peerIoAddrStr(&atom->addr,atom->port), wait ); continue; } } @@ -1896,7 +1893,7 @@ reconnectPulse( void * vtorrent ) io = tr_peerIoNewOutgoing( mgr->handle, &atom->addr, atom->port, t->hash ); if( io == NULL ) { - /* we've temporarily exceeded our max connection limit... */ + atom->myflags |= MYFLAG_UNREACHABLE; } else {