Ignore:
Timestamp:
Apr 17, 2008, 3:48:56 AM (14 years ago)
Author:
charles
Message:

(1) fix choke/unchoke error. (2) if a peer keeps trying to reconnect to us, hang up during the handshake.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/handshake.c

    r5065 r5632  
    2727#include "handshake.h"
    2828#include "peer-io.h"
     29#include "peer-mgr.h"
    2930#include "torrent.h"
    3031#include "trevent.h"
     
    811812    for( i=0; i<SHA_DIGEST_LENGTH; ++i )
    812813        obfuscatedTorrentHash[i] = req2[i] ^ req3[i];
    813     tor = tr_torrentFindFromObfuscatedHash( handshake->handle, obfuscatedTorrentHash );
    814     if( tor != NULL ) {
     814    if(( tor = tr_torrentFindFromObfuscatedHash( handshake->handle, obfuscatedTorrentHash )))
     815    {
    815816        dbgmsg( handshake, "found the torrent; it's [%s]", tor->info.name );
    816817        tr_peerIoSetTorrentHash( handshake->io, tor->info.hash );
    817     } else {
     818        if( !tr_torrentAllowsPex( tor ) &&
     819            tr_peerMgrPeerIsSeed( handshake->handle->peerMgr,
     820                                  tor->info.hash,
     821                                  tr_peerIoGetAddress( handshake->io, NULL )))
     822        {
     823            dbgmsg( handshake, "a peer has tried to reconnect to us!" );
     824            tr_handshakeDone( handshake, FALSE );
     825            return READ_DONE;
     826        }
     827    }
     828    else
     829    {
    818830        dbgmsg( handshake, "can't find that torrent..." );
    819831        tr_handshakeDone( handshake, FALSE );
Note: See TracChangeset for help on using the changeset viewer.