Changeset 6453
- Timestamp:
- Aug 8, 2008, 10:44:32 PM (13 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/peer-io.c
r6425 r6453 69 69 70 70 tr_crypto * crypto; 71 72 uint64_t fromPeer;73 71 }; 74 72 … … 540 538 { 541 539 case PEER_ENCRYPTION_NONE: 542 io->fromPeer +=evbuffer_remove( inbuf, bytes, byteCount );540 evbuffer_remove( inbuf, bytes, byteCount ); 543 541 break; 544 542 545 543 case PEER_ENCRYPTION_RC4: 546 io->fromPeer +=evbuffer_remove( inbuf, bytes, byteCount );544 evbuffer_remove( inbuf, bytes, byteCount ); 547 545 tr_cryptoDecrypt( io->crypto, byteCount, bytes, bytes ); 548 546 break; … … 596 594 return time( NULL ) - io->timeCreated; 597 595 } 598 599 int64_t600 tr_peerIoCountBytesFromPeer( const tr_peerIo * io )601 {602 return io->fromPeer;603 }604 -
trunk/libtransmission/peer-io.h
r6415 r6453 179 179 size_t byteCount ); 180 180 181 int64_t tr_peerIoCountBytesFromPeer( const tr_peerIo * io );182 181 183 182 #endif -
trunk/libtransmission/peer-mgr.c
r6450 r6453 45 45 46 46 /* minimum interval for refilling peers' request lists */ 47 REFILL_PERIOD_MSEC = 500,47 REFILL_PERIOD_MSEC = 333, 48 48 49 49 /* when many peers are available, keep idle ones this long */ … … 966 966 struct peer_atom * atom = getExistingAtom( t, addr ); 967 967 if( atom ) 968 { 969 /* if we talked but the connection failed, mark a failure 970 * in the peer's permanent record. if they didn't send 971 * us anything at all, mark the peer as unreachable. */ 972 if( tr_peerIoCountBytesFromPeer( io ) ) { 973 ++atom->numFails; 974 tordbg( t, "handshake failed; incremented fail count to %d", (int)atom->numFails ); 975 } else { 976 tordbg( t, "no data received at all during handshake; marking as unreachable" ); 977 atom->myflags |= MYFLAG_UNREACHABLE; 978 } 979 } 968 ++atom->numFails; 980 969 } 981 970 … … 1091 1080 const uint8_t * walk = compact; 1092 1081 tr_pex * pex = tr_new0( tr_pex, n ); 1082 if( added_f && strlen(added_f)!=n ) 1083 { 1084 int i; 1085 const int len = strlen( added_f ); 1086 fprintf( stderr, "compactLen is %d, n is %d, and strlen(added_f) is %d!!!\n", (int)compactLen, (int)n, len ); 1087 for( i=0; i<len; ++i ) 1088 fprintf( stderr, "added.f[%d] is %d\n", i, (int)added_f[i] ); 1089 } 1093 1090 for( i=0; i<n; ++i ) { 1094 1091 memcpy( &pex[i].in_addr, walk, 4 ); walk += 4; … … 1816 1813 if( wait > maxWait ) wait = maxWait; 1817 1814 if( ( now - atom->time ) < wait ) { 1818 /*tordbg( t, "RECONNECT peer %d (%s) is in its grace period of %d seconds..",1819 i, tr_peerIoAddrStr(&atom->addr,atom->port), wait );*/1815 tordbg( t, "RECONNECT peer %d (%s) is in its grace period of %d seconds..", 1816 i, tr_peerIoAddrStr(&atom->addr,atom->port), wait ); 1820 1817 continue; 1821 1818 } … … 1897 1894 if( io == NULL ) 1898 1895 { 1899 /* we've temporarily exceeded our max connection limit... */1896 atom->myflags |= MYFLAG_UNREACHABLE; 1900 1897 } 1901 1898 else
Note: See TracChangeset
for help on using the changeset viewer.