Changeset 6 for trunk/libtransmission


Ignore:
Timestamp:
Jan 12, 2006, 6:33:20 PM (16 years ago)
Author:
root
Message:

Update 2005-11-21

Location:
trunk/libtransmission
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/internal.h

    r3 r6  
    128128
    129129    int               status;
     130        int                               finished;
    130131    char              error[128];
    131132
  • trunk/libtransmission/metainfo.c

    r1 r6  
    4242    struct stat sb;
    4343
    44     snprintf( inf->torrent, MAX_PATH_LENGTH, path );
     44    snprintf( inf->torrent, MAX_PATH_LENGTH, "%s", path );
    4545
    4646    if( stat( path, &sb ) )
     
    143143        return 1;
    144144    }
    145     snprintf( inf->trackerAnnounce, MAX_PATH_LENGTH, s2 );
     145    snprintf( inf->trackerAnnounce, MAX_PATH_LENGTH, "%s", s2 );
    146146
    147147    /* Piece length */
  • trunk/libtransmission/tracker.c

    r3 r6  
    359359        tor->status |= TR_TRACKER_ERROR;
    360360        snprintf( tor->error, sizeof( tor->error ),
    361                   bePeers->val.s.s );
     361                  "%s", bePeers->val.s.s );
    362362        goto cleanup;
    363363    }
     
    607607    return 0;
    608608}
     609
     610int tr_trackerSeeders( tr_torrent_t * tor)
     611{
     612        if (tor->status != TR_STATUS_PAUSE)
     613        {
     614                return (tor->tracker)->seeders;
     615        }
     616        return 0;
     617}
     618
     619int tr_trackerLeechers( tr_torrent_t * tor)
     620{
     621        if (tor->status != TR_STATUS_PAUSE)
     622        {
     623                return (tor->tracker)->leechers;
     624        }
     625        return 0;
     626}
  • trunk/libtransmission/tracker.h

    r1 r6  
    3232void           tr_trackerClose     ( tr_tracker_t * );
    3333
     34/***********************************************************************
     35 * tr_trackerSeeders
     36 ***********************************************************************
     37 * Looks for the seeders/leechers as returned by the tracker.
     38 **********************************************************************/
     39int                         tr_trackerSeeders  ( tr_torrent_t * );
     40
     41/***********************************************************************
     42 * tr_trackerLeechers
     43 ***********************************************************************
     44 * Looks for the seeders/leechers as returned by the tracker.
     45 **********************************************************************/
     46int                         tr_trackerLeechers ( tr_torrent_t * );
     47
    3448int            tr_trackerScrape    ( tr_torrent_t *, int *, int * );
    3549
  • trunk/libtransmission/transmission.c

    r5 r6  
    173173    tor->id     = h->id;
    174174    tor->key    = h->key;
     175        tor->finished = 0;
     176
    175177
    176178    /* Guess scrape URL */
     
    316318{
    317319    return h->torrentCount;
     320}
     321
     322int tr_getFinished( tr_handle_t * h, int i)
     323{
     324        return h->torrents[i]->finished;
     325}
     326void tr_setFinished( tr_handle_t * h, int i, int val)
     327{
     328        h->torrents[i]->finished = val;
    318329}
    319330
     
    375386        s[i].rateDownload = rateDownload( tor );
    376387        s[i].rateUpload   = rateUpload( tor );
     388       
     389        s[i].seeders      = tr_trackerSeeders(tor);
     390                s[i].leechers     = tr_trackerLeechers(tor);
    377391
    378392        if( s[i].rateDownload < 0.1 )
     
    497511            /* Done */
    498512            tor->status = TR_STATUS_SEED;
     513                        tor->finished = 1;
    499514            tr_trackerCompleted( tor->tracker );
    500515        }
  • trunk/libtransmission/transmission.h

    r2 r6  
    7272
    7373/***********************************************************************
     74 * tr_getFinished
     75 ***********************************************************************
     76 * Tests to see if torrent is finished
     77 **********************************************************************/
     78int tr_getFinished( tr_handle_t *, int );
     79
     80/***********************************************************************
     81 * tr_setFinished
     82 ***********************************************************************
     83 * Sets the boolean value finished in the torrent back to false
     84 **********************************************************************/
     85void tr_setFinished( tr_handle_t *, int, int );
     86
     87/***********************************************************************
    7488 * tr_torrentInit
    7589 ***********************************************************************
     
    206220    int         peersDownloading;
    207221    char        pieces[120];
     222    int                 seeders;
     223        int                     leechers;
    208224
    209225    uint64_t    downloaded;
Note: See TracChangeset for help on using the changeset viewer.