Changeset 2329


Ignore:
Timestamp:
Jul 12, 2007, 6:54:39 PM (15 years ago)
Author:
charles
Message:

remove unused macros. constify some tracker functions.

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/tracker.c

    r2311 r2329  
    7373    int            complete;
    7474    int            randOffset;
    75    
     75
    7676    int            completelyUnconnectable;
    7777    int            allUnreachIfError;
     
    273273}
    274274
    275 static int shouldScrape( tr_tracker_t * tc )
     275static int shouldScrape( const tr_tracker_t * tc )
    276276{
    277277    uint64_t now, interval;
     
    297297}
    298298
    299 void tr_trackerAnnouncePulse( tr_tracker_t * tc, int * peerCount,
    300                               uint8_t ** peerCompact, int manual )
     299void
     300tr_trackerPulse( tr_tracker_t    * tc,
     301                 int             * peerCount,
     302                 uint8_t        ** peerCompact )
    301303{
    302304    const char   * data;
     
    312314    *peerCompact = NULL;
    313315   
    314     if( ( NULL == tc->http ) && ( manual || shouldConnect( tc ) ) )
    315     {
    316         /* if announcing manually, don't consider not reaching a
    317            tracker an error */
    318         if( manual )
    319         {
    320             tc->allUnreachIfError = 0;
    321         }
    322         tc->completelyUnconnectable = 0;
     316    if( ( NULL == tc->http ) && shouldConnect( tc ) )
     317    {
     318        tc->completelyUnconnectable = FALSE;
    323319       
    324320        tc->randOffset = tr_rand( 60000 );
     
    979975}
    980976
    981 int tr_trackerSeeders( tr_tracker_t * tc )
     977int tr_trackerSeeders( const tr_tracker_t * tc )
     978{
     979    return tc ? tc->seeders : -1;
     980}
     981
     982int tr_trackerLeechers( const tr_tracker_t * tc )
     983{
     984    return tc ? tc->leechers : -1;
     985}
     986
     987int tr_trackerDownloaded( const tr_tracker_t * tc )
     988{
     989    return tc ? tc->complete : -1;
     990}
     991
     992tr_tracker_info_t * tr_trackerGet( tr_tracker_t * tc )
    982993{
    983994    if( !tc )
    984995    {
    985         return -1;
    986     }
    987     return tc->seeders;
    988 }
    989 
    990 int tr_trackerLeechers( tr_tracker_t * tc )
    991 {
    992     if( !tc )
    993     {
    994         return -1;
    995     }
    996     return tc->leechers;
    997 }
    998 
    999 int tr_trackerDownloaded( tr_tracker_t * tc )
    1000 {
    1001     if( !tc )
    1002     {
    1003         return -1;
    1004     }
    1005     return tc->complete;
    1006 }
    1007 
    1008 tr_tracker_info_t * tr_trackerGet( tr_tracker_t * tc )
    1009 {
    1010     if( !tc )
    1011     {
    1012996        return NULL;
    1013997    }
     
    1015999}
    10161000
    1017 int tr_trackerCannotConnect( tr_tracker_t * tc )
    1018 {
    1019     if( !tc )
    1020     {
    1021         return 0;
    1022     }
    1023     return tc->completelyUnconnectable;
     1001int tr_trackerCannotConnect( const tr_tracker_t * tc )
     1002{
     1003    return tc && tc->completelyUnconnectable;
    10241004}
    10251005
  • trunk/libtransmission/tracker.h

    r1517 r2329  
    3030tr_tracker_t * tr_trackerInit      ( tr_torrent_t * );
    3131
    32 #define tr_trackerPulse(tc,a,b) tr_trackerAnnouncePulse((tc),(a),(b),0)
    33 void           tr_trackerAnnouncePulse( tr_tracker_t *, int * peerCount,
    34                                         uint8_t ** peerCompact, int );
     32void           tr_trackerPulse     ( tr_tracker_t *,
     33                                     int          * peerCount,
     34                                     uint8_t     ** peerCompact );
    3535
    3636void           tr_trackerCompleted( tr_tracker_t * );
     
    4343 * Looks for the seeders as returned by the tracker.
    4444 **********************************************************************/
    45 int tr_trackerSeeders  ( tr_tracker_t * );
     45int tr_trackerSeeders  ( const tr_tracker_t * );
    4646
    4747/***********************************************************************
     
    5050 * Looks for the leechers as returned by the tracker.
    5151 **********************************************************************/
    52 int tr_trackerLeechers ( tr_tracker_t * );
     52int tr_trackerLeechers ( const tr_tracker_t * );
    5353
    5454/***********************************************************************
     
    5858 * (from scrape).
    5959 **********************************************************************/
    60 int tr_trackerDownloaded( tr_tracker_t * tc );
     60int tr_trackerDownloaded( const tr_tracker_t * tc );
    6161
    6262/***********************************************************************
     
    6767tr_tracker_info_t * tr_trackerGet( tr_tracker_t * tc );
    6868
    69 int tr_trackerCannotConnect( tr_tracker_t * tc );
     69int tr_trackerCannotConnect( const tr_tracker_t * tc );
    7070
    7171/***********************************************************************
Note: See TracChangeset for help on using the changeset viewer.