Changeset 1603


Ignore:
Timestamp:
Mar 29, 2007, 12:19:09 AM (16 years ago)
Author:
joshe
Message:

Show peers found and used when adding new peers.
Accept --without-foo in addition to --disable-foo in the configure script.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure

    r1466 r1603  
    220220
    221221  case "x$1" in
    222     x--disable-openssl)
     222    x--disable-openssl|x--without-openssl)
    223223      OPENSSL=no
    224224      ;;
    225     x--disable-gtk)
     225    x--disable-gtk|x--without-gtk)
    226226      GTK=no
    227227      ;;
  • trunk/libtransmission/fastresume.h

    r1594 r1603  
    380380                if( !( TR_FLAG_PRIVATE & tor->info.flags ) )
    381381                {
     382                    int used;
    382383                    uint8_t * buf = malloc( len );
    383384                    if( 1 != fread( buf, len, 1, file ) )
     
    387388                        return 1;
    388389                    }
    389                     tr_torrentAddCompact( tor, TR_PEER_FROM_CACHE,
    390                                           buf, len / 6 );
     390                    used = tr_torrentAddCompact( tor, TR_PEER_FROM_CACHE,
     391                                                 buf, len / 6 );
     392                    tr_dbg( "found %i peers in resume file, used %i",
     393                            len / 6, used );
    391394                    free( buf );
    392395                }
  • trunk/libtransmission/internal.h

    r1600 r1603  
    147147#include "xml.h"
    148148
    149 void tr_torrentAddCompact( tr_torrent_t * tor, int from,
     149int tr_torrentAddCompact( tr_torrent_t * tor, int from,
    150150                           uint8_t * buf, int count );
    151 void tr_torrentAttachPeer( tr_torrent_t * tor, tr_peer_t * peer );
     151int tr_torrentAttachPeer( tr_torrent_t * tor, tr_peer_t * peer );
    152152
    153153struct tr_torrent_s
  • trunk/libtransmission/peeraz.h

    r1600 r1603  
    445445    tr_info_t * info = &tor->info;
    446446    benc_val_t  val, * list, * pair;
    447     int         ii;
     447    int         ii, used;
    448448
    449449    if( peer->private || PEX_PEER_CUTOFF <= tor->peerCount )
     
    484484    }
    485485
    486     peer_dbg( "GET  azureus-pex, %i peers", list->val.l.count );
    487 
     486    used = 0;
    488487    for( ii = 0; ii < list->val.l.count; ii++ )
    489488    {
     
    491490        if( TYPE_STR == pair->type && 6 == pair->val.s.i )
    492491        {
    493             tr_torrentAddCompact( tor, TR_PEER_FROM_PEX,
    494                                   ( uint8_t * )pair->val.s.s, 1 );
    495         }
    496     }
     492            used += tr_torrentAddCompact( tor, TR_PEER_FROM_PEX,
     493                                          ( uint8_t * )pair->val.s.s, 1 );
     494        }
     495    }
     496
     497    peer_dbg( "GET  azureus-pex, found %i peers, using %i",
     498              list->val.l.count, used );
    497499
    498500    tr_bencFree( &val );
  • trunk/libtransmission/peerext.h

    r1600 r1603  
    268268{
    269269    benc_val_t val, * sub;
     270    int used;
    270271
    271272    if( peer->private || PEX_PEER_CUTOFF <= tor->peerCount )
     
    291292    if( NULL != sub && TYPE_STR == sub->type && 0 == sub->val.s.i % 6 )
    292293    {
    293         peer_dbg( "GET  extended-pex, %i peers", sub->val.s.i / 6 );
    294         tr_torrentAddCompact( tor, TR_PEER_FROM_PEX,
    295                               ( uint8_t * )sub->val.s.s, sub->val.s.i / 6 );
     294        used = tr_torrentAddCompact( tor, TR_PEER_FROM_PEX,
     295                                     ( uint8_t * )sub->val.s.s,
     296                                     sub->val.s.i / 6 );
     297        peer_dbg( "GET  extended-pex, got %i peers, used %i",
     298                  sub->val.s.i / 6, used );
    296299    }
    297300    else
  • trunk/libtransmission/torrent.c

    r1595 r1603  
    283283void tr_manualUpdate( tr_torrent_t * tor )
    284284{
    285     int peerCount;
     285    int peerCount, new;
    286286    uint8_t * peerCompact;
    287287
     
    291291    tr_lockLock( &tor->lock );
    292292    tr_trackerAnnouncePulse( tor->tracker, &peerCount, &peerCompact, 1 );
     293    new = 0;
    293294    if( peerCount > 0 )
    294295    {
    295         tr_torrentAddCompact( tor, TR_PEER_FROM_TRACKER,
     296        new = tr_torrentAddCompact( tor, TR_PEER_FROM_TRACKER,
    296297                              peerCompact, peerCount );
    297298        free( peerCompact );
    298299    }
     300    tr_dbg( "got %i peers from manual announce, used %i", peerCount, new );
    299301    tr_lockUnlock( &tor->lock );
    300302}
     
    614616}
    615617
    616 void tr_torrentAttachPeer( tr_torrent_t * tor, tr_peer_t * peer )
     618int tr_torrentAttachPeer( tr_torrent_t * tor, tr_peer_t * peer )
    617619{
    618620    int i;
     
    622624    {
    623625        tr_peerDestroy(  peer );
    624         return;
     626        return 0;
    625627    }
    626628
     
    632634        {
    633635            tr_peerDestroy(  peer );
    634             return;
     636            return 0;
    635637        }
    636638    }
     
    639641    tr_peerSetTorrent( peer, tor );
    640642    tor->peers[tor->peerCount++] = peer;
    641 }
    642 
    643 void tr_torrentAddCompact( tr_torrent_t * tor, int from,
     643
     644    return 1;
     645}
     646
     647int tr_torrentAddCompact( tr_torrent_t * tor, int from,
    644648                           uint8_t * buf, int count )
    645649{
    646650    struct in_addr addr;
    647651    in_port_t port;
    648     int i;
     652    int i, added;
    649653    tr_peer_t * peer;
    650654
     655    added = 0;
    651656    for( i = 0; i < count; i++ )
    652657    {
     
    655660
    656661        peer = tr_peerInit( addr, port, -1, from );
    657         tr_torrentAttachPeer( tor, peer );
    658     }
     662        added += tr_torrentAttachPeer( tor, peer );
     663    }
     664
     665    return added;
    659666}
    660667
     
    666673    tr_torrent_t * tor = _tor;
    667674    int            i, ret;
    668     int            peerCount;
     675    int            peerCount, used;
    669676    uint8_t      * peerCompact;
    670677    tr_peer_t    * peer;
     
    696703        /* Try to get new peers or to send a message to the tracker */
    697704        tr_trackerPulse( tor->tracker, &peerCount, &peerCompact );
     705        used = 0;
    698706        if( peerCount > 0 )
    699707        {
    700             tr_torrentAddCompact( tor, TR_PEER_FROM_TRACKER,
    701                                   peerCompact, peerCount );
     708            used = tr_torrentAddCompact( tor, TR_PEER_FROM_TRACKER,
     709                                         peerCompact, peerCount );
    702710            free( peerCompact );
    703711        }
     712        tr_dbg( "got %i peers from announce, used %i", peerCount, used );
    704713        if( tor->status & TR_STATUS_STOPPED )
    705714        {
Note: See TracChangeset for help on using the changeset viewer.