From 9c3076481dd5da4babc85a143bba0771212abb7b Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 24 Dec 2010 03:30:52 +0000 Subject: [PATCH] hack to fix an issue in natpmp and upnp --- src/natpmp.cpp | 4 ++++ src/upnp.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/natpmp.cpp b/src/natpmp.cpp index 917c86e74..d89642ef7 100644 --- a/src/natpmp.cpp +++ b/src/natpmp.cpp @@ -73,6 +73,10 @@ natpmp::natpmp(io_service& ios, address const& listen_interface , m_disabled(false) , m_abort(false) { + // unfortunately async operations rely on the storage + // for this array not to be reallocated, by passing + // around pointers to its elements. so reserve size for now + m_mappings.reserve(10); rebind(listen_interface); } diff --git a/src/upnp.cpp b/src/upnp.cpp index 8e1b36c01..52989854c 100644 --- a/src/upnp.cpp +++ b/src/upnp.cpp @@ -88,6 +88,8 @@ upnp::upnp(io_service& ios, connection_queue& cc m_mappings.swap(s->mappings); delete s; } + + m_mappings.reserve(10); } void* upnp::drain_state()