Ignore:
Timestamp:
Mar 29, 2007, 12:19:09 AM (15 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.