summaryrefslogtreecommitdiffstats
path: root/libtransport
diff options
context:
space:
mode:
Diffstat (limited to 'libtransport')
-rw-r--r--libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc13
-rw-r--r--libtransport/src/hicn/transport/protocols/rtc.cc7
2 files changed, 18 insertions, 2 deletions
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_);
}
diff --git a/libtransport/src/hicn/transport/protocols/rtc.cc b/libtransport/src/hicn/transport/protocols/rtc.cc
index e3dcbbdbd..13c688d00 100644
--- a/libtransport/src/hicn/transport/protocols/rtc.cc
+++ b/libtransport/src/hicn/transport/protocols/rtc.cc
@@ -558,6 +558,13 @@ void RTCTransportProtocol::onContentObject(
uint32_t pkt = segmentNumber & modMask_;
bool schedule_next_interest = true;
+ ConsumerContentObjectCallback *callback_content_object = nullptr;
+ socket_->getSocketOption(ConsumerCallbacksOptions::CONTENT_OBJECT_INPUT,
+ &callback_content_object);
+ if (*callback_content_object != VOID_HANDLER) {
+ (*callback_content_object)(*socket_, *content_object);
+ }
+
if (payload_size == HICN_NACK_HEADER_SIZE) {
// Nacks always come form the producer, so we set the producerPathLabel_;
producerPathLabel_ = content_object->getPathLabel();