From a15388df5f1fa402b6c1346acc010f8d2ca5f42a Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 6 Apr 2014 01:03:01 +0000 Subject: [PATCH] back-port shutdown assert fix --- src/bandwidth_manager.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/bandwidth_manager.cpp b/src/bandwidth_manager.cpp index dc267f2bf..2777df86f 100644 --- a/src/bandwidth_manager.cpp +++ b/src/bandwidth_manager.cpp @@ -55,8 +55,17 @@ namespace libtorrent void bandwidth_manager::close() { m_abort = true; - m_queue.clear(); + + queue_t tm; + tm.swap(m_queue); m_queued_bytes = 0; + + while (!tm.empty()) + { + bw_request& bwr = tm.back(); + bwr.peer->assign_bandwidth(m_channel, bwr.assigned); + tm.pop_back(); + } } #if TORRENT_USE_ASSERTS