1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 17:17:31 +00:00

Quick fix for the 'getting unconnectable' problem (adds a timeout on

incoming connections)
This commit is contained in:
Eric Petit 2006-03-03 12:53:55 +00:00
parent a2066e56bf
commit eba49d3d2a
3 changed files with 12 additions and 0 deletions

View file

@ -264,6 +264,11 @@ int tr_peerRead( tr_torrent_t * tor, tr_peer_t * peer )
return 0; return 0;
} }
uint64_t tr_peerDate( tr_peer_t * peer )
{
return peer->date;
}
/*********************************************************************** /***********************************************************************
* tr_peerHash * tr_peerHash
*********************************************************************** ***********************************************************************

View file

@ -32,6 +32,7 @@ void tr_peerAttach ( tr_torrent_t *, tr_peer_t * );
void tr_peerDestroy ( tr_fd_t *, tr_peer_t * ); void tr_peerDestroy ( tr_fd_t *, tr_peer_t * );
void tr_peerRem ( tr_torrent_t *, int ); void tr_peerRem ( tr_torrent_t *, int );
int tr_peerRead ( tr_torrent_t *, tr_peer_t * ); int tr_peerRead ( tr_torrent_t *, tr_peer_t * );
uint64_t tr_peerDate ( tr_peer_t * );
uint8_t * tr_peerHash ( tr_peer_t * ); uint8_t * tr_peerHash ( tr_peer_t * );
void tr_peerPulse ( tr_torrent_t * ); void tr_peerPulse ( tr_torrent_t * );
int tr_peerIsConnected ( tr_peer_t * ); int tr_peerIsConnected ( tr_peer_t * );

View file

@ -655,6 +655,12 @@ static void acceptLoop( void * _h )
tr_peerDestroy( h->fdlimit, h->acceptPeers[ii] ); tr_peerDestroy( h->fdlimit, h->acceptPeers[ii] );
goto removePeer; goto removePeer;
} }
if( date1 > tr_peerDate( h->acceptPeers[ii] ) + 10000 )
{
/* Give them 10 seconds to send the handshake */
tr_peerDestroy( h->fdlimit, h->acceptPeers[ii] );
goto removePeer;
}
ii++; ii++;
continue; continue;
removePeer: removePeer: