From 88277fd736f9cd21e9c69125747b0f184d47173f Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 27 Apr 2007 02:33:09 +0000 Subject: [PATCH] fixed a bug where the web seed could be disconnected in the process of a response without noticing. checked in to RC_0_12 and trunk --- src/web_peer_connection.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/web_peer_connection.cpp b/src/web_peer_connection.cpp index 5d8dd99ef..2a6e60869 100755 --- a/src/web_peer_connection.cpp +++ b/src/web_peer_connection.cpp @@ -472,8 +472,14 @@ namespace libtorrent if (piece_size < front_request.length) return; + // each call to incoming_piece() may result in us becoming + // a seed. If we become a seed, all seeds we're connected to + // will be disconnected, including this web seed. We need to + // check for the disconnect condition after the call. + m_requests.pop_front(); incoming_piece(front_request, &m_piece[0]); + if (m_torrent.expired()) return; m_piece.clear(); } @@ -489,6 +495,7 @@ namespace libtorrent assert(http_body.left() >= r.length); incoming_piece(r, http_body.begin); + if (m_torrent.expired()) return; http_body.begin += r.length; }