From 9a7c55f13bc399c89d47c02d1f08eccf3bb5df5e Mon Sep 17 00:00:00 2001 From: michele papalini Date: Mon, 14 Oct 2019 11:10:19 +0200 Subject: [HICN-322] fix timeouts inside portal Signed-off-by: michele papalini Change-Id: I4ac176a11ed6f0b964274240dc0969051911183d --- libtransport/src/hicn/transport/core/portal.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libtransport/src/hicn') diff --git a/libtransport/src/hicn/transport/core/portal.h b/libtransport/src/hicn/transport/core/portal.h index 3ea37c938..17f35d819 100644 --- a/libtransport/src/hicn/transport/core/portal.h +++ b/libtransport/src/hicn/transport/core/portal.h @@ -417,8 +417,14 @@ class Portal { pending_interest->startCountdown(portal_details::makeCustomAllocatorHandler( async_callback_memory_, std::bind(&Portal::timerHandler, this, std::placeholders::_1, hash))); - pending_interest_hash_table_.emplace( - std::make_pair(hash, std::move(pending_interest))); + + auto it = pending_interest_hash_table_.find(hash); + if(it != pending_interest_hash_table_.end()){ + it->second->cancelTimer(); + it->second = std::move(pending_interest); + }else{ + pending_interest_hash_table_[hash] = std::move(pending_interest); + } } /** -- cgit 1.2.3-korg