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

(trunk libT) fix odd handshake bug reported by wereHamster

This commit is contained in:
Charles Kerr 2009-01-07 22:06:40 +00:00
parent 30ebbdaacb
commit 6917cac918

View file

@ -843,19 +843,19 @@ readCryptoProvide( tr_handshake * handshake,
tr_sha1( req3, "req3", 4, handshake->mySecret, KEY_LEN, NULL );
for( i = 0; i < SHA_DIGEST_LENGTH; ++i )
obfuscatedTorrentHash[i] = req2[i] ^ req3[i];
if( ( tor =
tr_torrentFindFromObfuscatedHash( handshake->session,
obfuscatedTorrentHash ) ) )
if(( tor = tr_torrentFindFromObfuscatedHash( handshake->session, obfuscatedTorrentHash )))
{
const tr_bool clientIsSeed = tr_torrentIsSeed( tor );
const tr_bool peerIsSeed = tr_peerMgrPeerIsSeed( handshake->session->peerMgr,
tor->info.hash,
tr_peerIoGetAddress( handshake->io, NULL ) );
dbgmsg( handshake, "got INCOMING connection's encrypted handshake for torrent [%s]",
tor->info.name );
tr_peerIoSetTorrentHash( handshake->io, tor->info.hash );
if( !tr_torrentAllowsPex( tor )
&& tr_peerMgrPeerIsSeed( handshake->session->peerMgr,
tor->info.hash,
tr_peerIoGetAddress( handshake->io, NULL ) ) )
if( clientIsSeed && peerIsSeed )
{
dbgmsg( handshake, "a peer has tried to reconnect to us!" );
dbgmsg( handshake, "another seed tried to reconnect to us!" );
return tr_handshakeDone( handshake, FALSE );
}
}