fixed bug in nat-pmp where it could access an out-of-bound vector element on shutdown

This commit is contained in:
Arvid Norberg 2008-09-24 02:20:13 +00:00
parent a36da15c29
commit bd44d730cc
1 changed files with 14 additions and 0 deletions

View File

@ -226,6 +226,20 @@ void natpmp::try_next_mapping(int i)
void natpmp::update_mapping(int i)
{
if (i == m_mappings.size())
{
if (m_abort)
{
error_code ec;
m_send_timer.cancel(ec);
m_socket.close(ec);
}
#if defined(TORRENT_LOGGING) || defined(TORRENT_VERBOSE_LOGGING)
m_log << " done" << (m_abort?" shutting down":"") << std::endl;
#endif
return;
}
natpmp::mapping_t& m = m_mappings[i];
if (m.action == mapping_t::action_none
|| m.protocol == none)