Changeset 54


Ignore:
Timestamp:
Jan 28, 2006, 4:05:20 AM (15 years ago)
Author:
titer
Message:

Ignore requests for blocks we don't have, fixes the "readOrWrite ..." error

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/inout.c

    r20 r54  
    391391    {
    392392        /* Should not happen */
    393         tr_err( "readOrWriteBytes: offset out of range" );
     393        tr_err( "readOrWriteBytes: offset out of range (%lld, %d, %d)",
     394                offset, size, write );
    394395        goto fail;
    395396    }
  • trunk/libtransmission/peermessages.h

    r3 r54  
    6060        /* We need to load the block for the next request */
    6161        r = &peer->outRequests[0];
     62
     63        /* Sanity check */
     64        if( !tr_cpPieceIsComplete( tor->completion, r->index ) )
     65        {
     66            /* We have been asked for something we don't have, buggy client?
     67               Let's just drop this request */
     68            tr_inf( "Block %d/%d/%d was requested but we don't have it",
     69                    r->index, r->begin, r->length );
     70            (peer->outRequestCount)--;
     71            memmove( &peer->outRequests[0], &peer->outRequests[1],
     72                     peer->outRequestCount * sizeof( tr_request_t ) );
     73            return NULL;
     74        }
     75       
    6276        p = (uint8_t *) peer->outBlock;
    6377
Note: See TracChangeset for help on using the changeset viewer.