Changeset 1145


Ignore:
Timestamp:
Nov 30, 2006, 9:02:52 PM (15 years ago)
Author:
livings124
Message:

reuse http query

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/scrape/libtransmission/tracker.c

    r1144 r1145  
    6161};
    6262
    63 static tr_http_t * getQuery   ( tr_tracker_t * tc );
     63static tr_http_t * getQuery ( tr_tracker_t * tc );
     64static tr_http_t * getScrapeQuery ( tr_tracker_t * tc );
    6465static void        readAnswer ( tr_tracker_t * tc, const char *, int );
    65 static void readScrapeAnswer( tr_tracker_t * tc, const char * data, int len );
     66static void        readScrapeAnswer( tr_tracker_t * tc, const char * data, int len );
    6667
    6768tr_tracker_t * tr_trackerInit( tr_torrent_t * tor )
     
    235236        }
    236237        tc->dateScrape = tr_date();
    237         tc->httpScrape = tr_httpClient( TR_HTTP_GET, inf->trackerAddress, inf->trackerPort,
    238                             "%s%sinfo_hash=%s", tor->scrape, strchr( tor->scrape, '?' ) ?
    239                             "&" : "?", tor->escapedHashString );
     238        tc->httpScrape = getScrapeQuery( tc );
    240239        tr_inf( "Scrape: sent http request to %s:%d",
    241240                    inf->trackerAddress, inf->trackerPort );
     
    281280    if( NULL != tc->http )
    282281    {
    283         /* If we are already sendy a query at the moment, we need to
     282        /* If we are already sending a query at the moment, we need to
    284283           reconnect */
    285284        tr_httpClose( tc->http );
     
    388387}
    389388
     389static tr_http_t * getScrapeQuery( tr_tracker_t * tc )
     390{
     391    tr_torrent_t * tor = tc->tor;
     392    tr_info_t    * inf = &tor->info;
     393
     394    return tr_httpClient( TR_HTTP_GET, inf->trackerAddress, inf->trackerPort,
     395                          "%s%sinfo_hash=%s", tor->scrape, strchr( tor->scrape, '?' ) ?
     396                          "&" : "?", tor->escapedHashString );
     397}
     398
    390399static void readAnswer( tr_tracker_t * tc, const char * data, int len )
    391400{
     
    774783
    775784    tc = tr_trackerInit( tor );
    776     http = tr_httpClient( TR_HTTP_GET, inf->trackerAddress, inf->trackerPort,
    777                           "%s%sinfo_hash=%s", tor->scrape, strchr( tor->scrape, '?' ) ?
    778                           "&" : "?", tor->escapedHashString );
     785    http = getScrapeQuery( tc );
    779786
    780787    for( data = NULL; !data; tr_wait( 10 ) )
Note: See TracChangeset for help on using the changeset viewer.