fix: webseed assertion failures (#2735)
This commit is contained in:
parent
377c335d0f
commit
0cd3eb26ff
|
@ -706,6 +706,8 @@ static void torrentInit(tr_torrent* tor, tr_ctor const* ctor)
|
|||
|
||||
tor->labels = tr_ctorGetLabels(ctor);
|
||||
|
||||
tor->uniqueId = session->torrents().add(tor);
|
||||
|
||||
tr_peerMgrAddTorrent(session->peerMgr, tor);
|
||||
|
||||
TR_ASSERT(tor->downloadedCur == 0);
|
||||
|
@ -760,8 +762,6 @@ static void torrentInit(tr_torrent* tor, tr_ctor const* ctor)
|
|||
tr_torrentSetIdleLimit(tor, tr_sessionGetIdleLimit(tor->session));
|
||||
}
|
||||
|
||||
tor->uniqueId = session->torrents().add(tor);
|
||||
|
||||
// if we don't have a local .torrent or .magnet file already, assume the torrent is new
|
||||
auto const filename = tor->hasMetadata() ? tor->torrentFile() : tor->magnetFile();
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ tr_torrents::tr_torrents()
|
|||
|
||||
tr_torrent const* tr_torrents::get(int id) const
|
||||
{
|
||||
TR_ASSERT(0 <= id);
|
||||
TR_ASSERT(0 < id);
|
||||
TR_ASSERT(static_cast<size_t>(id) < std::size(by_id_));
|
||||
if (static_cast<size_t>(id) >= std::size(by_id_))
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ tr_torrent const* tr_torrents::get(int id) const
|
|||
|
||||
tr_torrent* tr_torrents::get(int id)
|
||||
{
|
||||
TR_ASSERT(0 <= id);
|
||||
TR_ASSERT(0 < id);
|
||||
TR_ASSERT(static_cast<size_t>(id) < std::size(by_id_));
|
||||
if (static_cast<size_t>(id) >= std::size(by_id_))
|
||||
{
|
||||
|
|
|
@ -455,7 +455,7 @@ void onPartialDataFetched(tr_web::FetchResponse const& web_response)
|
|||
return;
|
||||
}
|
||||
|
||||
TR_ASSERT(evbuffer_get_length(task->content()) == 0);
|
||||
TR_ASSERT(evbuffer_get_length(task->content()) < tr_block_info::BlockSize);
|
||||
webseed->tasks.erase(task);
|
||||
delete task;
|
||||
|
||||
|
|
Loading…
Reference in New Issue