mirror of
https://github.com/transmission/transmission
synced 2024-12-25 01:03:01 +00:00
(trunk libT) #2792 "Since 1.80 update downloads failing" -- a better fix than r10015...
This commit is contained in:
parent
48d8d43c92
commit
f010687d81
1 changed files with 10 additions and 7 deletions
|
@ -714,6 +714,14 @@ countBlockRequests( Torrent * t, tr_block_index_t block )
|
|||
return n;
|
||||
}
|
||||
|
||||
static void
|
||||
decrementPendingReqCount( const struct block_request * b )
|
||||
{
|
||||
if( b->peer != NULL )
|
||||
if( b->peer->pendingReqsToPeer > 0 )
|
||||
--b->peer->pendingReqsToPeer;
|
||||
}
|
||||
|
||||
static void
|
||||
requestListRemove( Torrent * t, tr_block_index_t block, const tr_peer * peer )
|
||||
{
|
||||
|
@ -723,11 +731,7 @@ requestListRemove( Torrent * t, tr_block_index_t block, const tr_peer * peer )
|
|||
const int pos = b - t->requests;
|
||||
assert( pos < t->requestCount );
|
||||
|
||||
if( b->peer != NULL )
|
||||
{
|
||||
--b->peer->pendingReqsToPeer;
|
||||
assert( b->peer->pendingReqsToPeer >= 0 );
|
||||
}
|
||||
decrementPendingReqCount( b );
|
||||
|
||||
memmove( t->requests + pos,
|
||||
t->requests + pos + 1,
|
||||
|
@ -1143,8 +1147,7 @@ refillUpkeep( int foo UNUSED, short bar UNUSED, void * vmgr )
|
|||
for( it=cancel, end=it+cancelCount; it!=end; ++it ) {
|
||||
if( ( it->peer != NULL ) && ( it->peer->msgs != NULL ) ) {
|
||||
tr_peerMsgsCancel( it->peer->msgs, it->block );
|
||||
if( t->requestCount > 0 )
|
||||
--t->requestCount;
|
||||
decrementPendingReqCount( it );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue