aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/hicn/transport/interfaces
diff options
context:
space:
mode:
Diffstat (limited to 'libtransport/src/hicn/transport/interfaces')
-rw-r--r--libtransport/src/hicn/transport/interfaces/full_duplex_socket.cc2
-rwxr-xr-xlibtransport/src/hicn/transport/interfaces/rtc_socket_consumer.cc3
-rwxr-xr-xlibtransport/src/hicn/transport/interfaces/rtc_socket_consumer.h2
-rw-r--r--libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc18
-rwxr-xr-xlibtransport/src/hicn/transport/interfaces/rtc_socket_producer.h3
-rw-r--r--libtransport/src/hicn/transport/interfaces/socket_consumer.cc4
-rwxr-xr-xlibtransport/src/hicn/transport/interfaces/socket_consumer.h3
-rwxr-xr-xlibtransport/src/hicn/transport/interfaces/socket_producer.cc6
8 files changed, 33 insertions, 8 deletions
diff --git a/libtransport/src/hicn/transport/interfaces/full_duplex_socket.cc b/libtransport/src/hicn/transport/interfaces/full_duplex_socket.cc
index 37e1d7b3e..e06858cc3 100644
--- a/libtransport/src/hicn/transport/interfaces/full_duplex_socket.cc
+++ b/libtransport/src/hicn/transport/interfaces/full_duplex_socket.cc
@@ -397,7 +397,7 @@ void AsyncFullDuplexSocket::onContentRetrieved(ConsumerSocket &s,
return;
}
- TRANSPORT_LOGI("Received content with size %lu", size);
+ TRANSPORT_LOGI("Received content with size %zu", size);
if (!ec) {
read_callback_->readBufferAvailable(std::move(*receive_buffer_));
} else {
diff --git a/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.cc b/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.cc
index de3e84417..cc4f478af 100755
--- a/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.cc
+++ b/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.cc
@@ -22,6 +22,9 @@ namespace interface {
RTCConsumerSocket::RTCConsumerSocket(int protocol, asio::io_service &io_service)
: ConsumerSocket(protocol, io_service) {}
+RTCConsumerSocket::RTCConsumerSocket(int protocol)
+ : ConsumerSocket(protocol) {}
+
RTCConsumerSocket::~RTCConsumerSocket() {}
void RTCConsumerSocket::handleRTCPPacket(uint8_t *packet, size_t len) {
diff --git a/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.h b/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.h
index 86ccf6e22..cfde3128d 100755
--- a/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.h
+++ b/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.h
@@ -25,6 +25,8 @@ class RTCConsumerSocket : public ConsumerSocket {
public:
explicit RTCConsumerSocket(int protocol, asio::io_service &io_service);
+ explicit RTCConsumerSocket(int protocol);
+
~RTCConsumerSocket();
void handleRTCPPacket(uint8_t *packet, size_t len);
diff --git a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc
index 7b39e7ac9..f19502dee 100644
--- a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc
+++ b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc
@@ -55,6 +55,24 @@ RTCProducerSocket::RTCProducerSocket(asio::io_service &io_service)
prodLabel_ = ((rand() % 255) << 24UL);
}
+RTCProducerSocket::RTCProducerSocket()
+ : ProducerSocket(),
+ currentSeg_(1),
+ nack_(std::make_shared<ContentObject>()),
+ producedBytes_(0),
+ producedPackets_(0),
+ bytesProductionRate_(0),
+ packetsProductionRate_(INIT_PACKET_PRODUCTION_RATE),
+ perSecondFactor_(1000 / STATS_INTERVAL_DURATION) {
+ auto nack_payload = utils::MemBuf::create(NACK_HEADER_SIZE);
+ nack_payload->append(NACK_HEADER_SIZE);
+ nack_->appendPayload(std::move(nack_payload));
+ lastStats_ = std::chrono::steady_clock::now();
+ srand(time(NULL));
+ prodLabel_ = ((rand() % 255) << 24UL);
+}
+
+
RTCProducerSocket::~RTCProducerSocket() {}
void RTCProducerSocket::registerName(Prefix &producer_namespace) {
diff --git a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h
index 1a42bdc56..f1bcaa9e8 100755
--- a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h
+++ b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h
@@ -28,6 +28,9 @@ namespace interface {
class RTCProducerSocket : public ProducerSocket {
public:
RTCProducerSocket(asio::io_service &io_service);
+
+ RTCProducerSocket();
+
~RTCProducerSocket();
void registerName(Prefix &producer_namespace);
diff --git a/libtransport/src/hicn/transport/interfaces/socket_consumer.cc b/libtransport/src/hicn/transport/interfaces/socket_consumer.cc
index 27ed4e65f..89411e92c 100644
--- a/libtransport/src/hicn/transport/interfaces/socket_consumer.cc
+++ b/libtransport/src/hicn/transport/interfaces/socket_consumer.cc
@@ -99,7 +99,7 @@ int ConsumerSocket::consume(const Name &name,
transport_protocol_->start(receive_buffer);
- return CONSUMER_READY;
+ return CONSUMER_FINISHED;
}
int ConsumerSocket::asyncConsume(
@@ -115,7 +115,7 @@ int ConsumerSocket::asyncConsume(
});
}
- return CONSUMER_READY;
+ return CONSUMER_RUNNING;
}
void ConsumerSocket::asyncSendInterest(Interest::Ptr &&interest,
diff --git a/libtransport/src/hicn/transport/interfaces/socket_consumer.h b/libtransport/src/hicn/transport/interfaces/socket_consumer.h
index 9e309aae8..536d2fde3 100755
--- a/libtransport/src/hicn/transport/interfaces/socket_consumer.h
+++ b/libtransport/src/hicn/transport/interfaces/socket_consumer.h
@@ -26,8 +26,9 @@
#include <hicn/transport/utils/event_thread.h>
#include <hicn/transport/utils/sharable_vector.h>
-#define CONSUMER_READY 0
+#define CONSUMER_FINISHED 0
#define CONSUMER_BUSY 1
+#define CONSUMER_RUNNING 2
namespace transport {
diff --git a/libtransport/src/hicn/transport/interfaces/socket_producer.cc b/libtransport/src/hicn/transport/interfaces/socket_producer.cc
index 69adc2b3f..d9204f111 100755
--- a/libtransport/src/hicn/transport/interfaces/socket_producer.cc
+++ b/libtransport/src/hicn/transport/interfaces/socket_producer.cc
@@ -54,9 +54,9 @@ ProducerSocket::ProducerSocket(asio::io_service &io_service)
}
ProducerSocket::~ProducerSocket() {
- TRANSPORT_LOGI("Destroying the ProducerSocket");
+
processing_thread_stop_ = true;
- portal_->stopEventsLoop();
+ portal_->stopEventsLoop(true);
if (processing_thread_.joinable()) {
processing_thread_.join();
@@ -79,8 +79,6 @@ void ProducerSocket::serveForever() {
}
void ProducerSocket::stop() {
- TRANSPORT_LOGI("Calling stop for ProducerSocket");
- portal_->killConnection();
portal_->stopEventsLoop();
}