Changeset 1595


Ignore:
Timestamp:
Mar 26, 2007, 7:21:25 PM (15 years ago)
Author:
joshe
Message:

Revert unintended changes.

Location:
trunk/libtransmission
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/internal.h

    r1594 r1595  
    202202    uint64_t          uploadedPrev;
    203203
    204     uint8_t           pexDisabled;
    205 
    206204    tr_stat_t         stats[2];
    207205    int               statCur;
  • trunk/libtransmission/peer.c

    r1594 r1595  
    224224void tr_peerSetPrivate( tr_peer_t * peer, int private )
    225225{
    226     if( peer->private == private )
    227     {
    228         return;
    229     }
    230 
    231226    peer->private = private;
    232 
    233     if( !private )
    234     {
    235         peer->lastPex = 0;
    236     }
    237 
    238     if( EXTENDED_HANDSHAKE == peer->extStatus )
    239     {
    240         sendExtended( peer->tor, peer, EXTENDED_HANDSHAKE_ID );
    241     }
    242227}
    243228
  • trunk/libtransmission/peeraz.h

    r1594 r1595  
    152152            continue;
    153153        }
    154         /* XXX azureus sucks, we can't enable or disable pex after handshake */
    155154        if( AZ_MSG_AZ_PEER_EXCHANGE == azmsgId( idx ) && peer->private )
    156155        {
  • trunk/libtransmission/peerext.h

    r1594 r1595  
    128128    /* create dict of supported extended messages */
    129129    tr_bencInit( msgsval, TYPE_DICT );
    130     if( tr_bencDictAppendNofree( msgsval, "ut_pex", &pexval, NULL ) )
    131     {
    132         tr_bencFree( &val );
    133         return NULL;
    134     }
    135     /* for public torrents advertise utorrent pex message */
    136     tr_bencInitInt( pexval, ( peer->private ? 0 : EXTENDED_PEX_ID ) );
     130    if( !peer->private )
     131    {
     132        /* for public torrents advertise utorrent pex message */
     133        if( tr_bencDictAppendNofree( msgsval, "ut_pex", &pexval, NULL ) )
     134        {
     135            tr_bencFree( &val );
     136            return NULL;
     137        }
     138        tr_bencInitInt( pexval, EXTENDED_PEX_ID );
     139    }
    137140
    138141    /* our listening port */
     
    230233        {
    231234            peer->pexStatus = 0;
    232             if( 0x0 < sub->val.i && 0xff >= sub->val.i )
     235            if( !peer->private && 0x0 < sub->val.i && 0xff >= sub->val.i )
    233236            {
    234237                peer->pexStatus = sub->val.i;
  • trunk/libtransmission/torrent.c

    r1594 r1595  
    138138    }
    139139
    140     tor->pexDisabled = 0;
    141 
    142140    /* Block size: usually 16 ko, or less if we have to */
    143141    tor->blockSize  = MIN( inf->pieceSize, 1 << 14 );
     
    270268    }
    271269    tor->peerCount = 0;
    272     tr_lockUnlock( &tor->lock );
    273 }
    274 
    275 void tr_torrentDisablePex( tr_torrent_t * tor, int disable )
    276 {
    277     int ii;
    278 
    279     if( TR_FLAG_PRIVATE & tor->info.flags )
    280     {
    281         return;
    282     }
    283 
    284     tr_lockLock( &tor->lock );
    285 
    286     if( tor->pexDisabled == disable )
    287     {
    288         tr_lockUnlock( &tor->lock );
    289         return;
    290     }
    291 
    292     tor->pexDisabled = disable;
    293     for( ii = 0; ii < tor->peerCount; ii++ )
    294     {
    295         tr_peerSetPrivate( tor->peers[ii], disable );
    296     }
    297 
    298270    tr_lockUnlock( &tor->lock );
    299271}
     
    664636    }
    665637
    666     tr_peerSetPrivate( peer, tor->info.flags & TR_FLAG_PRIVATE ||
    667                        tor->pexDisabled );
     638    tr_peerSetPrivate( peer, tor->info.flags & TR_FLAG_PRIVATE );
    668639    tr_peerSetTorrent( peer, tor );
    669640    tor->peers[tor->peerCount++] = peer;
  • trunk/libtransmission/transmission.h

    r1594 r1595  
    224224                                    int flags, int * error );
    225225
    226 /***********************************************************************
    227  * tr_torrentDisablePex
    228  ***********************************************************************
    229  * Disable or enable peer exchange for this torrent. Peer exchange is
    230  * enabled by default, except for private torrents where pex is
    231  * disabled and cannot be enabled.
    232  **********************************************************************/
    233 void tr_torrentDisablePex( tr_torrent_t *, int disable );
    234 
    235 /***********************************************************************
    236  * tr_torrentScrape
    237  ***********************************************************************
    238  * Return torrent metainfo.
    239  **********************************************************************/
    240226typedef struct tr_info_s tr_info_t;
    241227tr_info_t * tr_torrentInfo( tr_torrent_t * );
Note: See TracChangeset for help on using the changeset viewer.