Wait for disowned http requests to finish to ensure stopped event gets sent to tracker on client shutdown.

This commit is contained in:
rakshasa
2012-05-01 00:29:50 +09:00
parent cf1c44ef5b
commit b79dea94b2
2 changed files with 11 additions and 2 deletions
+11 -1
View File
@@ -44,6 +44,7 @@
#include "core/download_store.h"
#include "core/view_manager.h"
#include "core/dht_manager.h"
#include "core/http_queue.h"
#include "display/canvas.h"
#include "display/window.h"
@@ -146,7 +147,16 @@ Control::cleanup_exception() {
bool
Control::is_shutdown_completed() {
return m_shutdownQuick && !worker_thread->is_active() && torrent::is_inactive();
if (!m_shutdownQuick || worker_thread->is_active())
return false;
// Tracker requests can be disowned, so wait for these to
// finish. The edge case of torrent http downloads may delay
// shutdown.
if (!core()->http_stack()->empty() || !core()->http_queue()->empty())
return false;
return torrent::is_inactive();
}
void
-1
View File
@@ -90,7 +90,6 @@ public:
core::ViewManager* view_manager() { return m_viewManager; }
core::DhtManager* dht_manager() { return m_dhtManager; }
ui::Root* ui() { return m_ui; }
display::Manager* display() { return m_display; }
input::Manager* input() { return m_input; }