Changeset 6865


Ignore:
Timestamp:
Oct 8, 2008, 3:58:21 AM (13 years ago)
Author:
charles
Message:

(libT) possible fix for #1305: Transmission losing data - Session Transfer significantly higher than actual download

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-msgs.c

    r6842 r6865  
    328328
    329329    struct evbuffer *      outBlock; /* buffer of the current piece message */
    330     struct evbuffer *      outMessages; /* buffer of all the non-piece messages
    331                                           */
     330    struct evbuffer *      outMessages; /* all the non-piece messages */
    332331
    333332    struct request_list    peerAskedFor;
     
    890889    while( ( count < max ) && reqListPop( &msgs->clientWillAskFor, &req ) )
    891890    {
     891        const tr_block_index_t block =
     892            _tr_block( msgs->torrent, req.index, req.offset );
     893
    892894        assert( requestIsValid( msgs, &req ) );
    893895        assert( tr_bitfieldHas( msgs->info->have, req.index ) );
    894896
    895         protocolSendRequest( msgs, &req );
    896         req.time_requested = now;
    897         reqListAppend( &msgs->clientAskedFor, &req );
    898 
    899         ++count;
    900         ++sent;
     897        /* don't ask for it if we've already got it... this block may have
     898         * come in from a different peer after we cancelled a request for it */
     899        if( !tr_cpBlockIsComplete( msgs->torrent->completion, block ) )
     900        {
     901            protocolSendRequest( msgs, &req );
     902            req.time_requested = now;
     903            reqListAppend( &msgs->clientAskedFor, &req );
     904
     905            ++count;
     906            ++sent;
     907        }
    901908    }
    902909
Note: See TracChangeset for help on using the changeset viewer.