forked from premiere/premiere-libtorrent
merge fix for deleting files from libtorrent_aio
This commit is contained in:
parent
f72f77aeb2
commit
6a47271667
|
@ -127,6 +127,8 @@ namespace libtorrent
|
|||
static sha1_hash empty;
|
||||
return m_torrent_file ? m_torrent_file->info_hash() : empty;
|
||||
}
|
||||
|
||||
bool is_deleted() const { return m_deleted; }
|
||||
|
||||
// starts the announce timer
|
||||
void start();
|
||||
|
@ -1388,6 +1390,11 @@ namespace libtorrent
|
|||
// accidentally start seeding it without any authentication.
|
||||
bool m_ssl_torrent:1;
|
||||
|
||||
// this is set to true if we're trying to delete the
|
||||
// files belonging to it. When set, don't write any
|
||||
// more blocks to disk!
|
||||
bool m_deleted:1;
|
||||
|
||||
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||
public:
|
||||
// set to false until we've loaded resume data
|
||||
|
|
|
@ -2472,6 +2472,8 @@ namespace libtorrent
|
|||
}
|
||||
}
|
||||
|
||||
if (t->is_deleted()) return;
|
||||
|
||||
int write_queue_size = fs.async_write(p, data, boost::bind(&peer_connection::on_disk_write_complete
|
||||
, self(), _1, _2, p, t));
|
||||
m_outstanding_writing_bytes += p.length;
|
||||
|
|
|
@ -428,6 +428,7 @@ namespace libtorrent
|
|||
, m_is_active_download(false)
|
||||
, m_is_active_finished(false)
|
||||
, m_ssl_torrent(false)
|
||||
, m_deleted(false)
|
||||
{
|
||||
// if there is resume data already, we don't need to trigger the initial save
|
||||
// resume data
|
||||
|
@ -1220,6 +1221,8 @@ namespace libtorrent
|
|||
int piece_size = m_torrent_file->piece_size(piece);
|
||||
int blocks_in_piece = (piece_size + block_size() - 1) / block_size();
|
||||
|
||||
if (m_deleted) return;
|
||||
|
||||
// avoid crash trying to access the picker when there is none
|
||||
if (!has_picker()) return;
|
||||
|
||||
|
@ -7029,6 +7032,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(m_storage);
|
||||
m_storage->async_delete_files(
|
||||
boost::bind(&torrent::on_files_deleted, shared_from_this(), _1, _2));
|
||||
m_deleted = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue