fixed the issue with the timer waiting for tracker requests when quitting, reported by Tianhao Qiu

This commit is contained in:
Arvid Norberg 2006-07-12 22:55:06 +00:00
parent 4403eac97b
commit 8c6869b4f2
4 changed files with 22 additions and 21 deletions

View File

@ -18,7 +18,7 @@
<tr><th class="docinfo-name">Author:</th> <tr><th class="docinfo-name">Author:</th>
<td>Arvid Norberg, <a class="last reference" href="mailto:arvid&#64;rasterbar.com">arvid&#64;rasterbar.com</a></td></tr> <td>Arvid Norberg, <a class="last reference" href="mailto:arvid&#64;rasterbar.com">arvid&#64;rasterbar.com</a></td></tr>
<tr><th class="docinfo-name">Version:</th> <tr><th class="docinfo-name">Version:</th>
<td>0.9.2</td></tr> <td>0.10</td></tr>
</tbody> </tbody>
</table> </table>
<div class="contents topic" id="table-of-contents"> <div class="contents topic" id="table-of-contents">

View File

@ -3,7 +3,7 @@ libtorrent manual
================= =================
:Author: Arvid Norberg, arvid@rasterbar.com :Author: Arvid Norberg, arvid@rasterbar.com
:Version: 0.9.2 :Version: 0.10
.. contents:: Table of contents .. contents:: Table of contents
:depth: 2 :depth: 2

View File

@ -212,7 +212,7 @@ namespace libtorrent
assert(m_open_mode & mode_out); assert(m_open_mode & mode_out);
assert(m_fd != -1); assert(m_fd != -1);
// Test this a bit more, what happens with random failures in // TODO: Test this a bit more, what happens with random failures in
// the files? // the files?
// if ((rand() % 100) > 80) // if ((rand() % 100) > 80)
// throw file_error("debug"); // throw file_error("debug");

View File

@ -966,7 +966,8 @@ namespace libtorrent { namespace detail
assert(false); assert(false);
} }
{ deadline_timer tracker_timer(m_selector);
session_impl::mutex_t::scoped_lock l(m_mutex); session_impl::mutex_t::scoped_lock l(m_mutex);
m_tracker_manager.abort_all_requests(); m_tracker_manager.abort_all_requests();
@ -983,15 +984,15 @@ namespace libtorrent { namespace detail
m_tracker_manager.queue_request(m_selector, req, login); m_tracker_manager.queue_request(m_selector, req, login);
} }
} }
m_timer.expires_from_now(boost::posix_time::seconds( tracker_timer.expires_from_now(boost::posix_time::seconds(
m_settings.stop_tracker_timeout)); m_settings.stop_tracker_timeout));
m_timer.async_wait(bind(&demuxer::interrupt, &m_selector)); tracker_timer.async_wait(bind(&demuxer::interrupt, &m_selector));
} l.unlock();
m_selector.reset(); m_selector.reset();
m_selector.run(); m_selector.run();
session_impl::mutex_t::scoped_lock l(m_mutex); l.lock();
assert(m_abort); assert(m_abort);
m_abort = true; m_abort = true;