From 0070232f7cc14c81dd1e79dc77808804807cd012 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 31 Mar 2009 08:02:25 +0000 Subject: [PATCH] attempt to fix #493 by keeping io_service running while there are still peer connections --- ChangeLog | 1 + include/libtorrent/peer_connection.hpp | 4 ++++ src/peer_connection.cpp | 2 ++ 3 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index ddee6ae8d..82afb120a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -56,6 +56,7 @@ release 0.14.3 or checking, to maintain stats and renamed files * Don't try IPv6 on windows if it's not installed * move_storage fix + * fixed potential crash on shutdown release 0.14.2 diff --git a/include/libtorrent/peer_connection.hpp b/include/libtorrent/peer_connection.hpp index 7f3e72fa6..a64cc0ef5 100644 --- a/include/libtorrent/peer_connection.hpp +++ b/include/libtorrent/peer_connection.hpp @@ -621,6 +621,10 @@ namespace libtorrent void on_disk_write_complete(int ret, disk_io_job const& j , peer_request r, boost::shared_ptr t); + // keep the io_service running as long as we + // have peer connections + io_service::work m_work; + // the time when we last got a part of a // piece packet from this peer ptime m_last_piece; diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index cd384c222..071487842 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -76,6 +76,7 @@ namespace libtorrent #endif m_ses(ses) , m_max_out_request_queue(m_ses.settings().max_out_request_queue) + , m_work(ses.m_io_service) , m_last_piece(time_now()) , m_last_request(time_now()) , m_last_incoming_request(min_time()) @@ -193,6 +194,7 @@ namespace libtorrent #endif m_ses(ses) , m_max_out_request_queue(m_ses.settings().max_out_request_queue) + , m_work(ses.m_io_service) , m_last_piece(time_now()) , m_last_request(time_now()) , m_last_incoming_request(min_time())