forked from premiere/premiere-libtorrent
fixed bug in add_piece() that would trigger asserts
This commit is contained in:
parent
c0635f0391
commit
1f44ec75a0
|
@ -28,6 +28,7 @@
|
||||||
incoming connection
|
incoming connection
|
||||||
* added more detailed instrumentation of the disk I/O thread
|
* added more detailed instrumentation of the disk I/O thread
|
||||||
|
|
||||||
|
* fixed bug in add_piece() that would trigger asserts
|
||||||
* fixed vs 2010 build
|
* fixed vs 2010 build
|
||||||
* recognizes more clients in identify_client()
|
* recognizes more clients in identify_client()
|
||||||
* fixed bug where trackers wouldn't be retried if they failed
|
* fixed bug where trackers wouldn't be retried if they failed
|
||||||
|
|
|
@ -276,7 +276,10 @@ namespace libtorrent
|
||||||
// marks this piece-block as queued for downloading
|
// marks this piece-block as queued for downloading
|
||||||
bool mark_as_downloading(piece_block block, void* peer
|
bool mark_as_downloading(piece_block block, void* peer
|
||||||
, piece_state_t s);
|
, piece_state_t s);
|
||||||
void mark_as_writing(piece_block block, void* peer);
|
// returns true if the block was marked as writing,
|
||||||
|
// and false if the block is already finished or writing
|
||||||
|
bool mark_as_writing(piece_block block, void* peer);
|
||||||
|
|
||||||
void mark_as_finished(piece_block block, void* peer);
|
void mark_as_finished(piece_block block, void* peer);
|
||||||
void write_failed(piece_block block);
|
void write_failed(piece_block block);
|
||||||
int num_peers(piece_block block) const;
|
int num_peers(piece_block block) const;
|
||||||
|
|
|
@ -2089,7 +2089,7 @@ namespace libtorrent
|
||||||
*j = i->peer_count + m_seeds;
|
*j = i->peer_count + m_seeds;
|
||||||
}
|
}
|
||||||
|
|
||||||
void piece_picker::mark_as_writing(piece_block block, void* peer)
|
bool piece_picker::mark_as_writing(piece_block block, void* peer)
|
||||||
{
|
{
|
||||||
#ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS
|
#ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS
|
||||||
TORRENT_PIECE_PICKER_INVARIANT_CHECK;
|
TORRENT_PIECE_PICKER_INVARIANT_CHECK;
|
||||||
|
@ -2133,7 +2133,10 @@ namespace libtorrent
|
||||||
info.peer = peer;
|
info.peer = peer;
|
||||||
if (info.state == block_info::state_requested) --i->requested;
|
if (info.state == block_info::state_requested) --i->requested;
|
||||||
TORRENT_ASSERT(i->requested >= 0);
|
TORRENT_ASSERT(i->requested >= 0);
|
||||||
TORRENT_ASSERT(info.state != block_info::state_writing);
|
if (info.state == block_info::state_writing
|
||||||
|
|| info.state == block_info::state_finished)
|
||||||
|
return false;
|
||||||
|
|
||||||
++i->writing;
|
++i->writing;
|
||||||
info.state = block_info::state_writing;
|
info.state = block_info::state_writing;
|
||||||
|
|
||||||
|
@ -2149,6 +2152,7 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
sort_piece(i);
|
sort_piece(i);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void piece_picker::write_failed(piece_block block)
|
void piece_picker::write_failed(piece_block block)
|
||||||
|
|
|
@ -676,7 +676,9 @@ namespace libtorrent
|
||||||
// avoid crash trying to access the picker when there is nont
|
// avoid crash trying to access the picker when there is nont
|
||||||
if (is_seed()) return;
|
if (is_seed()) return;
|
||||||
|
|
||||||
if (picker().have_piece(piece)) return;
|
if (picker().have_piece(piece)
|
||||||
|
&& (flags & torrent::overwrite_existing) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
peer_request p;
|
peer_request p;
|
||||||
p.piece = piece;
|
p.piece = piece;
|
||||||
|
|
Loading…
Reference in New Issue