From d4f259ccf0c2f5ff5058e833765cea56584aa66a Mon Sep 17 00:00:00 2001 From: arvidn Date: Wed, 24 Feb 2016 02:23:09 -0500 Subject: [PATCH] attempt to fix race when closing a web seed while it's receiving data --- src/web_peer_connection.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/web_peer_connection.cpp b/src/web_peer_connection.cpp index 5f9a2b1fd..518dcd636 100644 --- a/src/web_peer_connection.cpp +++ b/src/web_peer_connection.cpp @@ -937,6 +937,8 @@ void web_peer_connection::incoming_payload(char const* buf, int len) received_bytes(len, 0); m_received_body += len; + if (is_disconnecting()) return; + #ifndef TORRENT_DISABLE_LOGGING peer_log(peer_log_alert::incoming_message, "INCOMING_PAYLOAD", "%d bytes", len); #endif @@ -944,6 +946,8 @@ void web_peer_connection::incoming_payload(char const* buf, int len) // deliver all complete bittorrent requests to the bittorrent engine while (len > 0) { + if (m_requests.empty()) return; + TORRENT_ASSERT(!m_requests.empty()); peer_request const& front_request = m_requests.front(); int const piece_size = int(m_piece.size());