attempt to fix race when closing a web seed while it's receiving data

This commit is contained in:
arvidn 2016-02-24 02:23:09 -05:00
parent dcd6af6473
commit d4f259ccf0
1 changed files with 4 additions and 0 deletions

View File

@ -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());