Changeset 3290


Ignore:
Timestamp:
Oct 5, 2007, 12:16:47 AM (15 years ago)
Author:
charles
Message:

don't allow duplicate requests to the same peer, even during endgame. (alus)

Location:
trunk/libtransmission
Files:
3 edited

Legend:

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

    r3286 r3290  
    726726
    727727                case TR_ADDREQ_MISSING:
     728                case TR_ADDREQ_DUPLICATE:
    728729                    ++j;
    729730                    break;
  • trunk/libtransmission/peer-msgs.c

    r3280 r3290  
    483483                       uint32_t      length )
    484484{
    485     struct peer_request * req;
     485    struct peer_request tmp, *req;
    486486    int maxSize;
    487487
     
    499499    if( tr_list_size( msgs->clientAskedFor) >= maxSize )
    500500        return TR_ADDREQ_FULL;
     501
     502    /* have we already asked for this piece? */
     503    tmp.index = index;
     504    tmp.offset = offset;
     505    tmp.length = length;
     506    if( tr_list_remove( &msgs->clientAskedFor, &tmp, peer_request_compare ) != NULL )
     507        return TR_ADDREQ_DUPLICATE;
    501508
    502509    dbgmsg( msgs, "w00t peer has a max request queue size of %d... adding request for piece %d, offset %d", maxSize, (int)index, (int)offset );
     
    511518    /* add it to our `requests sent' list */
    512519    req = tr_new( struct peer_request, 1 );
    513     req->index = index;
    514     req->offset = offset;
    515     req->length = length;
     520    *req = tmp;
    516521    req->time_requested = msgs->lastReqAddedAt = time( NULL );
    517522    tr_list_append( &msgs->clientAskedFor, req );
  • trunk/libtransmission/peer-msgs.h

    r3278 r3290  
    4646    TR_ADDREQ_OK=0,
    4747    TR_ADDREQ_FULL,
     48    TR_ADDREQ_DUPLICATE,
    4849    TR_ADDREQ_MISSING,
    4950    TR_ADDREQ_CLIENT_CHOKED
Note: See TracChangeset for help on using the changeset viewer.