Ignore:
Timestamp:
Dec 6, 2006, 8:21:00 PM (15 years ago)
Author:
livings124
Message:

tracker should be set when added rather than when started

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/multitracker/libtransmission/transmission.c

    r1154 r1160  
    3434static void  acceptLoop( void * );
    3535static void acceptStop( tr_handle_t * h );
     36static int announceToScrape( char * announce, char * scrape );
    3637
    3738/***********************************************************************
     
    543544
    544545    return s;
     546}
     547
     548static int announceToScrape( char * announce, char * scrape )
     549{   
     550    char * slash, * nextSlash;
     551    int pre, post;
     552   
     553    slash = strchr( announce, '/' );
     554    while( ( nextSlash = strchr( slash + 1, '/' ) ) )
     555    {
     556        slash = nextSlash;
     557    }
     558    slash++;
     559   
     560    if( !strncmp( slash, "announce", 8 ) )
     561    {
     562        pre  = (long) slash - (long) announce;
     563        post = strlen( announce ) - pre - 8;
     564        memcpy( scrape, announce, pre );
     565        sprintf( &scrape[pre], "scrape" );
     566        memcpy( &scrape[pre+6], &announce[pre+8], post );
     567        scrape[pre+6+post] = 0;
     568       
     569        return 1;
     570    }
     571    else
     572    {
     573        return 0;
     574    }
     575}
     576
     577/* Must lock torrent before use */
     578void tr_setTorrentAnnounce( tr_info_t * inf, tr_announce_list_item_t * announceItem )
     579{
     580    snprintf( inf->trackerAddress, 256, "%s", announceItem->address );
     581    inf->trackerPort = announceItem->port;
     582    snprintf( inf->trackerAnnounce, MAX_PATH_LENGTH, "%s", announceItem->announce );
     583   
     584    inf->trackerCanScrape = announceToScrape( announceItem->announce, inf->trackerScrape );
    545585}
    546586
Note: See TracChangeset for help on using the changeset viewer.