Fix deletion of pending interest after timeout. 24/10824/1
authorMauro Sardara <[email protected]>
Mon, 26 Feb 2018 15:58:35 +0000 (16:58 +0100)
committerMauro Sardara <[email protected]>
Mon, 26 Feb 2018 15:58:35 +0000 (16:58 +0100)
Change-Id: Ie46025dff03eb859deb0dbb53238d687cf91860b
Signed-off-by: Mauro Sardara <[email protected]>
icnet/ccnx/icnet_ccnx_portal.cc

index c13a2e5..eeb1936 100644 (file)
@@ -70,11 +70,11 @@ void Portal::sendInterest(const Interest &interest,
     if (ec.value() != boost::system::errc::operation_canceled) {
       std::unordered_map<Name, std::unique_ptr<PendingInterest>>::iterator it = pending_interest_hash_table_.find(name);
       if (it != pending_interest_hash_table_.end()) {
-        it->second->getOnTimeoutCallback()(*it->second->getInterest());
+        std::unique_ptr<PendingInterest> 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);