fix bug in delay-load feature of torrents

This commit is contained in:
Arvid Norberg 2014-09-21 02:06:03 +00:00
parent c7a0bde196
commit 2936556573
1 changed files with 5 additions and 1 deletions

View File

@ -1343,7 +1343,11 @@ namespace libtorrent
// info_hash and peer_id. If we do. close this connection.
t->attach_peer(this);
if (m_disconnecting) return;
m_torrent = wpt;
// it's important to assign the torrent after successfully attaching.
// if the peer disconnects while attaching, it's not a proper member
// of the torrent and peer_connection::disconnect() will fail if it
// think it is
m_torrent = t;
if (m_exceeded_limit)
{