Changeset 3348


Ignore:
Timestamp:
Oct 10, 2007, 3:59:59 PM (15 years ago)
Author:
charles
Message:

fix a subtle bug with having two connections to the same peer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-mgr.c

    r3346 r3348  
    117117struct tr_peerMgr
    118118{
    119     int connectionCount;
    120119    tr_handle * handle;
    121120    tr_ptrArray * torrents; /* Torrent */
     
    895894    in_addr = tr_peerIoGetAddress( io, &port );
    896895
    897     if( !t || !t->isRunning )
     896    if( !ok || !t || !t->isRunning )
    898897    {
    899898        tr_peerIoFree( io );
    900         --manager->connectionCount;
    901     }
    902     else if( !ok )
    903     {
    904         /* if we couldn't connect or were snubbed,
    905          * the peer's probably not worth remembering. */
    906         tr_peer * peer = getExistingPeer( t, in_addr );
    907         tr_peerIoFree( io );
    908         --manager->connectionCount;
    909         if( peer )
    910             peer->doPurge = 1;
    911899    }
    912900    else /* looking good */
     
    922910            tordbg( t, "banned peer %s tried to reconnect", tr_peerIoAddrStr(&atom->addr,atom->port) );
    923911            tr_peerIoFree( io );
    924             --manager->connectionCount;
    925912            peer->doPurge = 1;
    926913        }
     
    928915        {
    929916            tr_peerIoFree( io );
    930             --manager->connectionCount;
    931917        }
    932918        else
     
    961947                                                    myHandshakeDoneCB,
    962948                                                    manager );
    963         ++manager->connectionCount;
    964949
    965950        tr_ptrArrayInsertSorted( manager->incomingHandshakes, handshake, handshakeCompare );
     
    16391624                                                        myHandshakeDoneCB,
    16401625                                                        mgr );
    1641             ++mgr->connectionCount;
    16421626
    16431627            assert( tr_peerIoGetTorrentHash( io ) != NULL );
Note: See TracChangeset for help on using the changeset viewer.