Changeset 3411


Ignore:
Timestamp:
Oct 14, 2007, 5:21:24 PM (15 years ago)
Author:
charles
Message:

Fix bug that could initiate pex in private torrents.

Location:
trunk/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/internal.h

    r3284 r3411  
    6262void tr_torrentUnlock  ( const tr_torrent * );
    6363
     64int tr_torrentIsPexEnabled( const tr_torrent * );
     65
    6466void tr_torrentChangeMyPort  ( tr_torrent * );
    6567
  • trunk/libtransmission/peer-mgr.c

    r3395 r3411  
    15061506        const int clientIsSeed = tr_cpGetStatus( tor->completion ) != TR_CP_INCOMPLETE;
    15071507        const int peerIsSeed = atom->flags & ADDED_F_SEED_FLAG;
    1508         if( peerIsSeed && clientIsSeed && ( tor->pexDisabled || (now-atom->time>=30) ) ) {
     1508        if( peerIsSeed && clientIsSeed && ( !tr_torrentIsPexEnabled(tor) || (now-atom->time>=30) ) ) {
    15091509            tordbg( t, "purging peer %s because we're both seeds", tr_peerIoAddrStr(&atom->addr,atom->port) );
    15101510            return TRUE;
     
    16031603
    16041604        /* if we used this peer recently, give someone else a turn */
    1605         if( ( now - atom->time ) < 60 ) {
     1605        if( ( now - atom->time ) < 180 ) {
    16061606            tordbg( t, "RECONNECT peer %d (%s) is in its grace period..",
    16071607                    i, tr_peerIoAddrStr(&atom->addr,atom->port) );
  • trunk/libtransmission/peer-msgs.c

    r3409 r3411  
    691691
    692692    /* decide if we want to advertise pex support */
    693     if( msgs->torrent->pexDisabled )
     693    if( !tr_torrentIsPexEnabled( msgs->torrent ) )
    694694        pex = 0;
    695695    else if( msgs->peerSentLtepHandshake )
     
    785785    uint8_t * tmp;
    786786
    787     if( msgs->torrent->pexDisabled ) /* no sharing! */
     787    if( !tr_torrentIsPexEnabled( msgs->torrent ) ) /* no sharing! */
    788788        return;
    789789
     
    15121512sendPex( tr_peermsgs * msgs )
    15131513{
    1514     if( msgs->peerSupportsPex && !msgs->torrent->pexDisabled )
     1514    if( msgs->peerSupportsPex && tr_torrentIsPexEnabled( msgs->torrent ) )
    15151515    {
    15161516        int i;
     
    16341634    m->clientAllowedPieces = NULL;
    16351635    setme = tr_publisherSubscribe( m->publisher, func, userData );
    1636     tr_peerIoSetTimeoutSecs( m->io, 150 ); /* error if we don't read or write for 2.5 minutes */
    16371636   
    16381637    if ( tr_peerIoSupportsFEXT( m->io ) )
     
    16511650    }
    16521651   
     1652    tr_peerIoSetTimeoutSecs( m->io, 150 ); /* error if we don't read or write for 2.5 minutes */
    16531653    tr_peerIoSetIOFuncs( m->io, canRead, didWrite, gotError, m );
    16541654    tr_peerIoSetIOMode( m->io, EV_READ|EV_WRITE, 0 );
  • trunk/libtransmission/torrent.c

    r3407 r3411  
    645645}
    646646
     647int
     648tr_torrentIsPexEnabled( const tr_torrent * tor )
     649{
     650    if( tor->info.flags & TR_FLAG_PRIVATE )
     651        return FALSE;
     652
     653    if( tor->pexDisabled )
     654        return FALSE;
     655
     656    return TRUE;
     657}
    647658
    648659void
Note: See TracChangeset for help on using the changeset viewer.