From bd2bcf12bca248832040737f719ac74df2fe4dfc Mon Sep 17 00:00:00 2001 From: arvidn Date: Mon, 15 Jun 2015 02:27:09 -0400 Subject: [PATCH] fix bug on write-only disk errors (it's not supposed to stop the torrent) --- src/torrent.cpp | 6 +++--- test/test_transfer.cpp | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/torrent.cpp b/src/torrent.cpp index eea6c17ca..67e6eec61 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -1156,9 +1156,6 @@ namespace libtorrent alerts().emplace_alert(j->error.ec , resolve_filename(j->error.file), j->error.operation_str(), get_handle()); - // put the torrent in an error-state - set_error(j->error.ec, j->error.file); - // if a write operation failed, and future writes are likely to // fail, while reads may succeed, just set the torrent to upload mode // if we make an incorrect assumption here, it's not the end of the @@ -1182,6 +1179,9 @@ namespace libtorrent return; } + // put the torrent in an error-state + set_error(j->error.ec, j->error.file); + // if the error appears to be more serious than a full disk, just pause the torrent pause(); } diff --git a/test/test_transfer.cpp b/test/test_transfer.cpp index 3d15dd1c8..f346cbc9a 100644 --- a/test/test_transfer.cpp +++ b/test/test_transfer.cpp @@ -311,6 +311,9 @@ void test_transfer(int proxy_type, settings_pack const& sett print_alerts(ses1, "ses1", true, true, true, &on_alert); print_alerts(ses2, "ses2", true, true, true, &on_alert); + std::string err = tor2.status().error; + fprintf(stderr, "error: \"%s\"\n", err.c_str()); + TEST_CHECK(err.empty()); tor2.set_upload_mode(false); // at this point we probably disconnected the seed