exception fixes

This commit is contained in:
Arvid Norberg 2007-05-24 17:07:43 +00:00
parent 1eb819b901
commit 58b23a79e7
2 changed files with 26 additions and 4 deletions

View File

@ -949,7 +949,18 @@ namespace libtorrent { namespace detail
continue;
}
c.keep_alive();
try
{
c.keep_alive();
}
catch (std::exception& exc)
{
#ifdef TORRENT_VERBOSE_LOGGING
(*c.m_logger) << "**ERROR**: " << exc.what() << "\n";
#endif
c.set_failed();
c.disconnect();
}
}
// check each torrent for tracker updates
@ -981,7 +992,6 @@ namespace libtorrent { namespace detail
}
m_stat.second_tick(tick_interval);
// distribute the maximum upload rate among the torrents
assert(m_max_uploads >= -1);

View File

@ -2454,13 +2454,25 @@ namespace libtorrent
}
for (peer_iterator i = m_connections.begin();
i != m_connections.end(); ++i)
i != m_connections.end();)
{
peer_connection* p = i->second;
++i;
m_stat += p->statistics();
// updates the peer connection's ul/dl bandwidth
// resource requests
p->second_tick(tick_interval);
try
{
p->second_tick(tick_interval);
}
catch (std::exception& e)
{
#ifdef TORRENT_VERBOSE_LOGGING
(*p->m_logger) << "**ERROR**: " << e.what() << "\n";
#endif
p->set_failed();
p->disconnect();
}
}
accumulator += m_stat;
m_stat.second_tick(tick_interval);