Fixes a race condition

This commit is contained in:
Eric Petit 2007-01-30 20:06:42 +00:00
parent 706a2ade11
commit 6ab640c50b
1 changed files with 6 additions and 0 deletions

View File

@ -95,6 +95,12 @@ static uint8_t * blockPending( tr_torrent_t * tor, tr_peer_t * peer,
tr_ioRead( tor->io, r->index, r->begin, r->length, &p[13] );
if( peer->outRequestCount < 1 )
{
/* We were choked during the read */
return NULL;
}
peer_dbg( "SEND piece %d/%d (%d bytes)",
r->index, r->begin, r->length );