Changeset 12129


Ignore:
Timestamp:
Mar 11, 2011, 5:48:57 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) fix r12127 bug with delegating https trackers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/announcer.c

    r12128 r12129  
    718718}
    719719
    720 static tr_bool
    721 tier_announce_event_pull( tr_tier * tier, tr_announce_event * setme )
    722 {
    723     const tr_bool success = tier->announce_event_count > 0;
    724 
    725     if( success )
    726     {
    727         *setme = tier->announce_events[0];
    728 
    729         tr_removeElementFromArray( tier->announce_events,
    730                                    0, sizeof( tr_announce_event ),
    731                                    tier->announce_event_count-- );
    732     }
    733 
    734     return success;
     720static tr_announce_event
     721tier_announce_event_pull( tr_tier * tier )
     722{
     723    const tr_announce_event e = tier->announce_events[0];
     724
     725    tr_removeElementFromArray( tier->announce_events,
     726                               0, sizeof( tr_announce_event ),
     727                               tier->announce_event_count-- );
     728
     729    return e;
    735730}
    736731
     
    908903    const time_t now = tr_time( );
    909904    const tr_announce_event event = data->event;
     905
     906    if( announcer )
     907        ++announcer->slotsAvailable;
    910908
    911909    if( tier != NULL )
     
    10351033    }
    10361034
    1037     if( announcer )
    1038         ++announcer->slotsAvailable;
    1039 
    10401035    tr_free( data );
    10411036}
     
    10491044    tr_session * session = announcer->session;
    10501045
    1051     if( strstr( request->url, "http://" ) )
     1046    if( !memcmp( request->url, "http", 4 ) )
    10521047        tr_tracker_http_announce( session, request, callback, callback_data );
    10531048    else
    1054         fprintf( stderr, "can't handle [%s] yet\n", request->url );
     1049        abort();//fprintf( stderr, "can't handle [%s] yet\n", request->url );
    10551050
    10561051    tr_free( request->tracker_id_str );
     
    10631058{
    10641059    tr_announce_event announce_event;
     1060    tr_announce_request * req;
     1061    struct announce_data * data;
     1062    const tr_torrent * tor = tier->tor;
     1063    const time_t now = tr_time( );
    10651064
    10661065    assert( !tier->isAnnouncing );
    1067 
    1068     if( tier_announce_event_pull( tier, &announce_event ) )
    1069     {
    1070         struct announce_data * data;
    1071         const tr_torrent * tor = tier->tor;
    1072         const time_t now = tr_time( );
    1073 
    1074         tr_announce_request * req = announce_request_new( announcer, tor, tier, announce_event );
    1075 
    1076         data = tr_new0( struct announce_data, 1 );
    1077         data->tierId = tier->key;
    1078         data->isRunningOnSuccess = tor->isRunning;
    1079         data->timeSent = now;
    1080         data->event = announce_event;
    1081 
    1082         tier->isAnnouncing = TRUE;
    1083         tier->lastAnnounceStartTime = now;
    1084         --announcer->slotsAvailable;
    1085 
    1086         announce_request_delegate( announcer, req, on_announce_done, data );
    1087     }
     1066    assert( tier->announce_event_count > 0 );
     1067
     1068    announce_event = tier_announce_event_pull( tier );
     1069    req = announce_request_new( announcer, tor, tier, announce_event );
     1070
     1071    data = tr_new0( struct announce_data, 1 );
     1072    data->tierId = tier->key;
     1073    data->isRunningOnSuccess = tor->isRunning;
     1074    data->timeSent = now;
     1075    data->event = announce_event;
     1076
     1077    tier->isAnnouncing = TRUE;
     1078    tier->lastAnnounceStartTime = now;
     1079    --announcer->slotsAvailable;
     1080
     1081    announce_request_delegate( announcer, req, on_announce_done, data );
    10881082}
    10891083
     
    13081302    const time_t now = tr_time( );
    13091303
     1304    dbgmsg( NULL, "announceMore: slotsAvailable is %d", announcer->slotsAvailable );
     1305
    13101306    if( announcer->slotsAvailable > 0 )
    13111307    {
Note: See TracChangeset for help on using the changeset viewer.