From: Mauro Sardara Date: Mon, 26 Feb 2018 15:58:35 +0000 (+0100) Subject: Fix deletion of pending interest after timeout. X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=de35d6c871dd14591c62c880c0571a99bbd9b6c8;p=cicn.git Fix deletion of pending interest after timeout. Change-Id: Ie46025dff03eb859deb0dbb53238d687cf91860b Signed-off-by: Mauro Sardara --- diff --git a/icnet/ccnx/icnet_ccnx_portal.cc b/icnet/ccnx/icnet_ccnx_portal.cc index c13a2e58..eeb19360 100644 --- a/icnet/ccnx/icnet_ccnx_portal.cc +++ b/icnet/ccnx/icnet_ccnx_portal.cc @@ -70,11 +70,11 @@ void Portal::sendInterest(const Interest &interest, if (ec.value() != boost::system::errc::operation_canceled) { std::unordered_map>::iterator it = pending_interest_hash_table_.find(name); if (it != pending_interest_hash_table_.end()) { - it->second->getOnTimeoutCallback()(*it->second->getInterest()); + std::unique_ptr ptr = std::move(it->second); + pending_interest_hash_table_.erase(it); + ptr->getOnTimeoutCallback()(*ptr->getInterest()); } } - - pending_interest_hash_table_.erase(name); }; pend_interest->startCountdown(timer_callback);