From 41878be65785063472c3a69139347efe3952492a Mon Sep 17 00:00:00 2001 From: michele papalini Date: Wed, 3 Apr 2019 18:28:04 +0200 Subject: [HICN-96] add callbacks in RTC Change-Id: Ide96e5798ab57f057de6a6f91078a5082f69e313 Signed-off-by: michele papalini --- .../src/hicn/transport/interfaces/rtc_socket_producer.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'libtransport/src/hicn/transport/interfaces') diff --git a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc index 57ac081dc..cea421703 100644 --- a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc +++ b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc @@ -148,6 +148,11 @@ void RTCProducerSocket::produce(const uint8_t *buf, size_t buffer_size) { content_object.setLifetime(500); // XXX this should be set by the APP content_object.setPathLabel(prodLabel_); + + if (on_content_object_output_ != VOID_HANDLER) { + on_content_object_output_(*this, content_object); + } + portal_->sendContentObject(content_object); currentSeg_++; @@ -178,8 +183,7 @@ void RTCProducerSocket::onInterest(Interest::Ptr &&interest) { max_gap = (uint32_t)floor( (double)((double)((double)lifetime * INTEREST_LIFETIME_REDUCTION_FACTOR / - 1000.0) * - (double)packetsProductionRate_.load())); + 1000.0) * (double)packetsProductionRate_.load())); if (interestSeg < currentSeg_ || interestSeg > (max_gap + currentSeg_)) { sendNack(*interest); @@ -200,6 +204,11 @@ void RTCProducerSocket::sendNack(const Interest &interest) { nack_->setLifetime(0); nack_->setPathLabel(prodLabel_); + + if (on_content_object_output_ != VOID_HANDLER) { + on_content_object_output_(*this, *nack_); + } + portal_->sendContentObject(*nack_); } -- cgit 1.2.3-korg