void * userData;
tr_crypto * crypto;
-
- uint64_t fromPeer;
};
/**
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;
{
return time( NULL ) - io->timeCreated;
}
-
-int64_t
-tr_peerIoCountBytesFromPeer( const tr_peerIo * io )
-{
- return io->fromPeer;
-}
-
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),
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 );
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;
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;
}
}
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
{