fixed issue with torrents with 0 pieces. Fixes #306

This commit is contained in:
Arvid Norberg 2008-05-15 02:29:26 +00:00
parent fb154e91f8
commit 91d6099a55
3 changed files with 4 additions and 2 deletions

View File

@ -288,6 +288,7 @@ namespace libtorrent
void peer_connection::start()
{
TORRENT_ASSERT(m_peer_info == 0 || m_peer_info->connection == this);
boost::shared_ptr<torrent> t = m_torrent.lock();
if (!t)

View File

@ -2465,7 +2465,8 @@ namespace libtorrent
&& m_free_slots.empty()
&& m_state == state_finished)
{
TORRENT_ASSERT(m_storage_mode != storage_mode_compact);
TORRENT_ASSERT(m_storage_mode != storage_mode_compact
|| m_info->num_pieces() == 0);
}
if (m_storage_mode != storage_mode_compact)

View File

@ -2579,6 +2579,7 @@ namespace libtorrent
// add the newly connected peer to this torrent's peer list
m_connections.insert(boost::get_pointer(c));
m_ses.m_connections.insert(c);
peerinfo->connection = c.get();
c->start();
int timeout = settings().peer_connect_timeout;
@ -2603,7 +2604,6 @@ namespace libtorrent
return false;
}
#endif
peerinfo->connection = c.get();
return true;
}