]> granicus.if.org Git - transmission/commitdiff
back out the changes from r6415.
authorCharles Kerr <charles@transmissionbt.com>
Fri, 8 Aug 2008 22:44:32 +0000 (22:44 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Fri, 8 Aug 2008 22:44:32 +0000 (22:44 +0000)
libtransmission/peer-io.c
libtransmission/peer-io.h
libtransmission/peer-mgr.c

index 38d51dc7bda07fbe633107698705bf45807a072d..c2b463e422fc2a9ccb2b0e91a39bfb10fb4dcfd0 100644 (file)
@@ -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;
-}
-
index 953a8271c56912e3130f6a65ded63fb7e420d957..fede9c4b9db889eeb10fb6c45af885ac481d3557 100644 (file)
@@ -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
index 939ac2cdf1253d20fa24afb8e01e3faa2d747dfd..d3622bb13275aa08db646ae8c33e5ab5ab0c0e04 100644 (file)
@@ -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<len; ++i )
+        fprintf( stderr, "added.f[%d] is %d\n", i, (int)added_f[i] );
+}
     for( i=0; i<n; ++i ) {
         memcpy( &pex[i].in_addr, walk, 4 ); walk += 4;
         memcpy( &pex[i].port, walk, 2 ); walk += 2;
@@ -1815,8 +1812,8 @@ getPeerCandidates( Torrent * t, int * setmeSize )
             if( wait < minWait ) wait = minWait;
             if( wait > 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
             {