fixed natpmp (broken in [3023])
This commit is contained in:
@@ -58,6 +58,7 @@ natpmp::natpmp(io_service& ios, address const& listen_interface, portmap_callbac
|
|||||||
, m_refresh_timer(ios)
|
, m_refresh_timer(ios)
|
||||||
, m_next_refresh(-1)
|
, m_next_refresh(-1)
|
||||||
, m_disabled(false)
|
, m_disabled(false)
|
||||||
|
, m_abort(false)
|
||||||
{
|
{
|
||||||
rebind(listen_interface);
|
rebind(listen_interface);
|
||||||
}
|
}
|
||||||
@@ -298,13 +299,18 @@ void natpmp::send_map_request(int i)
|
|||||||
error_code ec;
|
error_code ec;
|
||||||
m_socket.send_to(asio::buffer(buf, 12), m_nat_endpoint, 0, ec);
|
m_socket.send_to(asio::buffer(buf, 12), m_nat_endpoint, 0, ec);
|
||||||
m.map_sent = true;
|
m.map_sent = true;
|
||||||
// linear back-off instead of exponential
|
|
||||||
if (m_abort)
|
if (m_abort)
|
||||||
{
|
{
|
||||||
|
// when we're shutting down, ignore the
|
||||||
|
// responses and just remove all mappings
|
||||||
|
// immediately
|
||||||
|
m_currently_mapping = -1;
|
||||||
|
m.action = mapping_t::action_none;
|
||||||
try_next_mapping(i);
|
try_next_mapping(i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// linear back-off instead of exponential
|
||||||
++m_retry_count;
|
++m_retry_count;
|
||||||
m_send_timer.expires_from_now(milliseconds(250 * m_retry_count), ec);
|
m_send_timer.expires_from_now(milliseconds(250 * m_retry_count), ec);
|
||||||
m_send_timer.async_wait(bind(&natpmp::resend_request, self(), i, _1));
|
m_send_timer.async_wait(bind(&natpmp::resend_request, self(), i, _1));
|
||||||
|
Reference in New Issue
Block a user