Changeset 12982


Ignore:
Timestamp:
Oct 14, 2011, 12:27:14 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) #4526 "do not skip scrape unless all three scrape fields came with announce" -- add field initializers.

Location:
trunk/libtransmission
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/announcer-http.c

    r12914 r12982  
    292292
    293293    d = tr_new0( struct announce_data, 1 );
     294    d->response.seeders = -1;
     295    d->response.leechers = -1;
     296    d->response.downloads = -1;
    294297    d->response_func = response_func;
    295298    d->response_func_user_data = response_func_user_data;
     
    464467    d->response.row_count = request->info_hash_count;
    465468    for( i=0; i<d->response.row_count; ++i )
     469    {
    466470        memcpy( d->response.rows[i].info_hash, request->info_hash[i], SHA_DIGEST_LENGTH );
     471        d->response.rows[i].seeders = -1;
     472        d->response.rows[i].leechers = -1;
     473        d->response.rows[i].downloads = -1;
     474    }
    467475    tr_strlcpy( d->log_name, request->log_name, sizeof( d->log_name ) );
    468476
  • trunk/libtransmission/announcer-udp.c

    r12247 r12982  
    184184    req->payload = tr_memdup( evbuffer_pullup( buf, -1 ), req->payload_len );
    185185    for( i=0; i<req->response.row_count; ++i )
     186    {
     187        req->response.rows[i].seeders = -1;
     188        req->response.rows[i].leechers = -1;
     189        req->response.rows[i].downloads = -1;
    186190        memcpy( req->response.rows[i].info_hash,
    187191                in->info_hash[i], SHA_DIGEST_LENGTH );
     192    }
    188193
    189194    /* cleanup */
     
    335340    req->payload_len = evbuffer_get_length( buf );
    336341    req->payload = tr_memdup( evbuffer_pullup( buf, -1 ), req->payload_len );
     342    req->response.seeders = -1;
     343    req->response.leechers = -1;
     344    req->response.downloads = -1;
    337345    memcpy( req->response.info_hash, in->info_hash, SHA_DIGEST_LENGTH );
    338346
  • trunk/libtransmission/announcer.c

    r12956 r12982  
    10741074            const char * str;
    10751075            int scrape_fields = 0;
     1076            int seeders = 0;
     1077            int leechers = 0;
     1078            int downloads = 0;
    10761079            const bool isStopped = event == TR_ANNOUNCE_EVENT_STOPPED;
    10771080
     
    10841087                if( response->seeders >= 0 )
    10851088                {
    1086                     tracker->seederCount = response->seeders;
     1089                    tracker->seederCount = seeders = response->seeders;
    10871090                    ++scrape_fields;
    10881091                }
     
    10901093                if( response->leechers >= 0 )
    10911094                {
    1092                     tracker->leecherCount = response->leechers;
     1095                    tracker->leecherCount = leechers = response->leechers;
    10931096                    ++scrape_fields;
    10941097                }
    10951098                if( response->downloads >= 0 )
    10961099                {
    1097                     tracker->downloadCount = response->downloads;
     1100                    tracker->downloadCount = downloads = response->downloads;
    10981101                    ++scrape_fields;
    10991102                }
     
    11261129
    11271130            if( response->pex_count > 0 )
    1128                 publishPeersPex( tier, response->seeders, response->leechers,
     1131                publishPeersPex( tier, seeders, leechers,
    11291132                                 response->pex, response->pex_count );
    11301133
    11311134            if( response->pex6_count > 0 )
    1132                 publishPeersPex( tier, response->seeders, response->leechers,
     1135                publishPeersPex( tier, seeders, leechers,
    11331136                                 response->pex6, response->pex6_count );
    11341137
     
    13471350                    if(( tracker = tier->currentTracker ))
    13481351                    {
    1349                         tracker->seederCount = row->seeders;
    1350                         tracker->leecherCount = row->leechers;
    1351                         tracker->downloadCount = row->downloads;
     1352                        if( row->seeders >= 0 )
     1353                            tracker->seederCount = row->seeders;
     1354                        if( row->leechers >= 0 )
     1355                            tracker->leecherCount = row->leechers;
     1356                        if( row->downloads >= 0 )
     1357                            tracker->downloadCount = row->downloads;
    13521358                        tracker->downloaderCount = row->downloaders;
    13531359                        tracker->consecutiveFailures = 0;
Note: See TracChangeset for help on using the changeset viewer.