aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h
diff options
context:
space:
mode:
authormichele papalini <micpapal@cisco.com>2019-10-08 11:20:25 +0200
committermichele papalini <micpapal@cisco.com>2019-10-08 11:20:25 +0200
commite8e399a5fd74ff35f703364c876e01679f0606b7 (patch)
tree2407e54c25666f5e8eef52076ea65371e332a499 /libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h
parent1bc4aca90da898424da7609af59aec5ac4770f73 (diff)
[HICN-302] low rate traffic in RTC
Signed-off-by: michele papalini <micpapal@cisco.com> Change-Id: Ib6511d82abc91e9008588cd2b7fd80022c6d232b
Diffstat (limited to 'libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h')
-rw-r--r--libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h
index 5b9a23dd7..aa67f1a29 100644
--- a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h
+++ b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h
@@ -41,8 +41,10 @@ class RTCProducerSocket : public ProducerSocket {
void onInterest(Interest::Ptr &&interest) override;
private:
- void sendNack(const Interest &interest, bool isActive);
+ void sendNack(uint32_t sequence, bool isActive);
void updateStats(uint32_t packet_size, uint64_t now);
+ void scheduleTimer(uint64_t wait);
+ void interestCacheTimer();
uint32_t currentSeg_;
uint32_t prodLabel_;
@@ -55,6 +57,20 @@ class RTCProducerSocket : public ProducerSocket {
uint32_t perSecondFactor_;
uint64_t lastStats_;
+ // cache for the received interests
+ // this map maps the expiration time of an interest to
+ // its sequence number. the map is sorted by timeouts
+ // the same timeout may be used for multiple sequence numbers
+ // but for each sequence number we store only the smallest
+ // expiry time. In this way the mapping from seqs_map_ to
+ // timers_map_ is unique
+ std::multimap<uint64_t,uint32_t> timers_map_;
+ // this map does the opposite, this map is not ordered
+ std::unordered_map<uint32_t,uint64_t> seqs_map_;
+ bool timer_on_;
+ std::unique_ptr<asio::steady_timer> interests_cache_timer_;
+ utils::SpinLock interests_cache_lock_;
+
uint64_t lastProduced_;
bool active_;
utils::SpinLock lock_;