Changeset 10064


Ignore:
Timestamp:
Feb 1, 2010, 3:49:59 AM (12 years ago)
Author:
charles
Message:

(trunk libT) a better way to ignore peerCount from `stopped' responses

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/announcer.c

    r10063 r10064  
    10751075                       const char  * response,
    10761076                       size_t        responseLen,
     1077                       tr_bool       isStopped,
    10771078                       tr_bool     * gotScrape )
    10781079{
     
    10931094        const char * str;
    10941095        const uint8_t * raw;
    1095         tr_bool gotPeers = FALSE;
    10961096
    10971097        success = TRUE;
     
    11561156            const int allAreSeeds = incomplete == 0;
    11571157            peerCount += publishNewPeersCompact( tier, allAreSeeds, raw, rawlen );
    1158             gotPeers = TRUE;
    11591158        }
    11601159        else if( tr_bencDictFindList( &benc, "peers", &tmp ) )
     
    11651164            uint8_t * array = parseOldPeers( tmp, &byteCount );
    11661165            peerCount += publishNewPeers( tier, allAreSeeds, array, byteCount );
    1167             gotPeers = TRUE;
    11681166            tr_free( array );
    11691167        }
     
    11741172            const tr_bool allAreSeeds = incomplete == 0;
    11751173            peerCount += publishNewPeersCompact6( tier, allAreSeeds, raw, rawlen );
    1176             gotPeers = TRUE;
    11771174        }
    11781175
     
    11811178                        sizeof( tier->lastAnnounceStr ) );
    11821179
    1183         if( gotPeers )
     1180        if( !isStopped )
    11841181            tier->lastAnnouncePeerCount = peerCount;
    11851182    }
     
    11981195    int tierId;
    11991196    time_t timeSent;
     1197    const char * event;
    12001198
    12011199    /** If the request succeeds, the value for tier's "isRunning" flag */
     
    12161214    tr_bool success = FALSE;
    12171215    const time_t now = time ( NULL );
     1216    const tr_bool isStopped = !strcmp( data->event, "stopped" );
    12181217
    12191218    if( announcer && tier )
     
    12301229        if( responseCode == HTTP_OK )
    12311230        {
    1232             success = parseAnnounceResponse( tier, response, responseLen, &gotScrape );
     1231            success = parseAnnounceResponse( tier, response, responseLen, isStopped, &gotScrape );
    12331232            dbgmsg( tier, "success is %d", success );
    12341233        }
     
    13861385    data->isRunningOnSuccess = tor->isRunning;
    13871386    data->timeSent = now;
    1388 
    1389     url = createAnnounceURL( announcer, tor, tier, getAnnounceEvent( tier ) );
     1387    data->event = getAnnounceEvent( tier );
     1388    url = createAnnounceURL( announcer, tor, tier, data->event );
    13901389
    13911390    tier->isAnnouncing = TRUE;
Note: See TracChangeset for help on using the changeset viewer.