aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/implementation
diff options
context:
space:
mode:
authorMauro <you@example.com>2021-06-30 07:57:22 +0000
committerMauro Sardara <msardara@cisco.com>2021-07-06 16:16:04 +0000
commit08233d44a6cfde878d7e10bca38ae935ed1c8fd5 (patch)
tree7ecc534d55bdc7e8dd15ecab084720910bcdf4d9 /libtransport/src/implementation
parent147ba39bed26887f5eba84757e2463ab8e370a9a (diff)
[HICN-713] Transport Library Major Refactoring 2
Co-authored-by: Luca Muscariello <muscariello@ieee.org> Co-authored-by: Michele Papalini <micpapal@cisco.com> Co-authored-by: Olivier Roques <oroques+fdio@cisco.com> Co-authored-by: Giulio Grassi <gigrassi@cisco.com> Signed-off-by: Mauro Sardara <msardara@cisco.com> Change-Id: I5b2c667bad66feb45abdb5effe22ed0f6c85d1c2
Diffstat (limited to 'libtransport/src/implementation')
-rw-r--r--libtransport/src/implementation/CMakeLists.txt2
-rw-r--r--libtransport/src/implementation/p2psecure_socket_consumer.cc6
-rw-r--r--libtransport/src/implementation/p2psecure_socket_producer.cc23
-rw-r--r--libtransport/src/implementation/p2psecure_socket_producer.h2
-rw-r--r--libtransport/src/implementation/rtc_socket_producer.cc352
-rw-r--r--libtransport/src/implementation/rtc_socket_producer.h74
-rw-r--r--libtransport/src/implementation/socket_consumer.h4
-rw-r--r--libtransport/src/implementation/socket_producer.h4
-rw-r--r--libtransport/src/implementation/tls_rtc_socket_producer.cc2
-rw-r--r--libtransport/src/implementation/tls_socket_producer.cc11
10 files changed, 18 insertions, 462 deletions
diff --git a/libtransport/src/implementation/CMakeLists.txt b/libtransport/src/implementation/CMakeLists.txt
index 392c99e15..daf899d06 100644
--- a/libtransport/src/implementation/CMakeLists.txt
+++ b/libtransport/src/implementation/CMakeLists.txt
@@ -11,8 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
-
list(APPEND HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/socket.h
${CMAKE_CURRENT_SOURCE_DIR}/socket_producer.h
diff --git a/libtransport/src/implementation/p2psecure_socket_consumer.cc b/libtransport/src/implementation/p2psecure_socket_consumer.cc
index 0b5966e71..4b14da5d2 100644
--- a/libtransport/src/implementation/p2psecure_socket_consumer.cc
+++ b/libtransport/src/implementation/p2psecure_socket_consumer.cc
@@ -251,7 +251,7 @@ int P2PSecureConsumerSocket::handshake() {
network_name_ = producer_namespace_.getRandomName();
network_name_.setSuffix(0);
- TRANSPORT_LOGD("Start handshake at %s", network_name_.toString().c_str());
+ DLOG_IF(INFO, VLOG_IS_ON(2)) << "Start handshake at " << network_name_;
result = SSL_connect(this->ssl_);
return result;
@@ -291,7 +291,7 @@ int P2PSecureConsumerSocket::consume(const Name &name) {
if (handshake() != 1) {
throw errors::RuntimeException("Unable to perform client handshake");
} else {
- TRANSPORT_LOGD("Handshake performed!");
+ DLOG_IF(INFO, VLOG_IS_ON(2)) << "Handshake performed!";
}
initSessionSocket();
@@ -320,7 +320,7 @@ int P2PSecureConsumerSocket::asyncConsume(const Name &name) {
if (handshake() != 1) {
throw errors::RuntimeException("Unable to perform client handshake");
} else {
- TRANSPORT_LOGD("Handshake performed!");
+ DLOG_IF(INFO, VLOG_IS_ON(2)) << "Handshake performed!";
}
initSessionSocket();
diff --git a/libtransport/src/implementation/p2psecure_socket_producer.cc b/libtransport/src/implementation/p2psecure_socket_producer.cc
index aa14f9e37..3748001fc 100644
--- a/libtransport/src/implementation/p2psecure_socket_producer.cc
+++ b/libtransport/src/implementation/p2psecure_socket_producer.cc
@@ -50,19 +50,8 @@ P2PSecureProducerSocket::P2PSecureProducerSocket(
map_producers(),
list_producers() {
/* Setup SSL context (identity and parameter to use TLS 1.3) */
- der_cert_ = parcKeyStore_GetDEREncodedCertificate(
- (identity->getSigner()->getParcKeyStore()));
- der_prk_ = parcKeyStore_GetDEREncodedPrivateKey(
- (identity->getSigner()->getParcKeyStore()));
-
- int cert_size = (int)parcBuffer_Limit(der_cert_);
- int prk_size = (int)parcBuffer_Limit(der_prk_);
- const uint8_t *cert =
- reinterpret_cast<uint8_t *>(parcBuffer_Overlay(der_cert_, cert_size));
- const uint8_t *prk =
- reinterpret_cast<uint8_t *>(parcBuffer_Overlay(der_prk_, prk_size));
- cert_509_ = d2i_X509(NULL, &cert, cert_size);
- pkey_rsa_ = d2i_AutoPrivateKey(NULL, &prk, prk_size);
+ cert_509_ = identity->getCertificate().get();
+ pkey_rsa_ = identity->getPrivateKey().get();
/* Set the callback so that when an interest is received we catch it and we
* decrypt the payload before passing it to the application. */
@@ -73,10 +62,7 @@ P2PSecureProducerSocket::P2PSecureProducerSocket(
std::placeholders::_1, std::placeholders::_2));
}
-P2PSecureProducerSocket::~P2PSecureProducerSocket() {
- if (der_cert_) parcBuffer_Release(&der_cert_);
- if (der_prk_) parcBuffer_Release(&der_prk_);
-}
+P2PSecureProducerSocket::~P2PSecureProducerSocket() {}
void P2PSecureProducerSocket::initSessionSocket(
std::unique_ptr<TLSProducerSocket> &producer) {
@@ -128,8 +114,7 @@ void P2PSecureProducerSocket::onInterestCallback(interface::ProducerSocket &p,
TLSProducerSocket *tls_producer_ptr = tls_producer.get();
map_producers.insert({interest.getName(), move(tls_producer)});
- TRANSPORT_LOGD("Start handshake at %s",
- interest.getName().toString().c_str());
+ DLOG_IF(INFO, VLOG_IS_ON(3)) << "Start handshake at " << interest.getName();
if (!rtc_) {
tls_producer_ptr->onInterest(*tls_producer_ptr, interest);
diff --git a/libtransport/src/implementation/p2psecure_socket_producer.h b/libtransport/src/implementation/p2psecure_socket_producer.h
index b7c3d1958..f94347258 100644
--- a/libtransport/src/implementation/p2psecure_socket_producer.h
+++ b/libtransport/src/implementation/p2psecure_socket_producer.h
@@ -103,8 +103,6 @@ class P2PSecureProducerSocket : public ProducerSocket {
std::mutex mtx_;
/* Condition variable for the wait */
std::condition_variable cv_;
- PARCBuffer *der_cert_;
- PARCBuffer *der_prk_;
X509 *cert_509_;
EVP_PKEY *pkey_rsa_;
std::unordered_map<core::Name, std::unique_ptr<TLSProducerSocket>,
diff --git a/libtransport/src/implementation/rtc_socket_producer.cc b/libtransport/src/implementation/rtc_socket_producer.cc
deleted file mode 100644
index a5b2b4a0e..000000000
--- a/libtransport/src/implementation/rtc_socket_producer.cc
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * Copyright (c) 2017-2019 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <hicn/transport/interfaces/callbacks.h>
-
-#include <implementation/rtc_socket_producer.h>
-#include <stdlib.h>
-#include <time.h>
-
-#define NACK_HEADER_SIZE 8 // bytes
-#define TIMESTAMP_LEN 8 // bytes
-#define TCP_HEADER_SIZE 20
-#define IP6_HEADER_SIZE 40
-#define INIT_PACKET_PRODUCTION_RATE 100 // pps random value (almost 1Mbps)
-#define STATS_INTERVAL_DURATION 500 // ms
-#define INTEREST_LIFETIME_REDUCTION_FACTOR 0.8
-#define INACTIVE_TIME \
- 500 // ms without producing before the socket
- // is considered inactive
-#define MILLI_IN_A_SEC 1000 // ms in a second
-
-#define HICN_MAX_DATA_SEQ 0xefffffff
-
-// slow production rate param
-#define MIN_PRODUCTION_RATE \
- 10 // in pacekts per sec. this value is computed
- // through experiments
-#define LIFETIME_FRACTION 0.5
-
-// NACK HEADER
-// +-----------------------------------------+
-// | 4 bytes: current segment in production |
-// +-----------------------------------------+
-// | 4 bytes: production rate (bytes x sec) |
-// +-----------------------------------------+
-//
-
-// PACKET HEADER
-// +-----------------------------------------+
-// | 8 bytes: TIMESTAMP |
-// +-----------------------------------------+
-// | packet |
-// +-----------------------------------------+
-
-namespace transport {
-namespace implementation {
-
-RTCProducerSocket::RTCProducerSocket(interface::ProducerSocket *producer_socket)
- : ProducerSocket(producer_socket),
- currentSeg_(1),
- producedBytes_(0),
- producedPackets_(0),
- bytesProductionRate_(INIT_PACKET_PRODUCTION_RATE * 1400),
- packetsProductionRate_(INIT_PACKET_PRODUCTION_RATE),
- perSecondFactor_(MILLI_IN_A_SEC / STATS_INTERVAL_DURATION),
- timer_on_(false) {
- srand((unsigned int)time(NULL));
- prodLabel_ = ((rand() % 255) << 24UL);
- interests_cache_timer_ =
- std::make_unique<asio::steady_timer>(this->getIoService());
- round_timer_ = std::make_unique<asio::steady_timer>(this->getIoService());
- setSocketOption(GeneralTransportOptions::OUTPUT_BUFFER_SIZE, 10000U);
- scheduleRoundTimer();
-}
-
-RTCProducerSocket::~RTCProducerSocket() {}
-
-void RTCProducerSocket::registerPrefix(const Prefix &producer_namespace) {
- ProducerSocket::registerPrefix(producer_namespace);
-
- flowName_ = producer_namespace.getName();
- auto family = flowName_.getAddressFamily();
-
- switch (family) {
- case AF_INET6:
- headerSize_ = (uint32_t)Packet::getHeaderSizeFromFormat(HF_INET6_TCP);
- break;
- case AF_INET:
- headerSize_ = (uint32_t)Packet::getHeaderSizeFromFormat(HF_INET_TCP);
- break;
- default:
- throw errors::RuntimeException("Unknown name format.");
- }
-}
-
-void RTCProducerSocket::scheduleRoundTimer() {
- round_timer_->expires_from_now(
- std::chrono::milliseconds(STATS_INTERVAL_DURATION));
- round_timer_->async_wait([this](std::error_code ec) {
- if (ec) return;
- updateStats();
- });
-}
-
-void RTCProducerSocket::updateStats() {
- bytesProductionRate_ = producedBytes_.load() * perSecondFactor_;
- packetsProductionRate_ = producedPackets_.load() * perSecondFactor_;
- if (packetsProductionRate_.load() == 0) packetsProductionRate_ = 1;
- producedBytes_ = 0;
- producedPackets_ = 0;
- scheduleRoundTimer();
-}
-
-void RTCProducerSocket::produce(std::unique_ptr<utils::MemBuf> &&buffer) {
- auto buffer_size = buffer->length();
-
- if (TRANSPORT_EXPECT_FALSE(buffer_size == 0)) {
- return;
- }
-
- if (TRANSPORT_EXPECT_FALSE((buffer_size + headerSize_ + TIMESTAMP_LEN) >
- data_packet_size_)) {
- return;
- }
-
- uint64_t now = std::chrono::duration_cast<std::chrono::milliseconds>(
- std::chrono::steady_clock::now().time_since_epoch())
- .count();
-
- producedBytes_ += (uint32_t)(buffer_size + headerSize_ + TIMESTAMP_LEN);
- producedPackets_++;
-
- Name n(flowName_);
- auto content_object =
- std::make_shared<ContentObject>(n.setSuffix(currentSeg_.load()));
- auto payload = utils::MemBuf::create(TIMESTAMP_LEN);
-
- memcpy(payload->writableData(), &now, TIMESTAMP_LEN);
- payload->append(TIMESTAMP_LEN);
- payload->prependChain(std::move(buffer));
- content_object->appendPayload(std::move(payload));
-
- content_object->setLifetime(500); // XXX this should be set by the APP
-
- content_object->setPathLabel(prodLabel_);
-
- output_buffer_.insert(std::static_pointer_cast<ContentObject>(
- content_object->shared_from_this()));
-
- if (on_content_object_in_output_buffer_) {
- on_content_object_in_output_buffer_(*getInterface(), *content_object);
- }
-
- TRANSPORT_LOGD("Send content %u (produce)",
- content_object->getName().getSuffix());
- portal_->sendContentObject(*content_object);
-
- if (on_content_object_output_) {
- on_content_object_output_(*getInterface(), *content_object);
- }
-
- uint32_t old_curr = currentSeg_.load();
- currentSeg_ = (currentSeg_.load() + 1) % HICN_MAX_DATA_SEQ;
-
- // remove interests from the interest cache if it exists
- // this generates nacks that will tell to the consumer
- // that a new data packet was produced
- utils::SpinLock::Acquire locked(interests_cache_lock_);
- if (!seqs_map_.empty()) {
- for (auto it = seqs_map_.begin(); it != seqs_map_.end(); it++) {
- if (it->first != old_curr) sendNack(it->first);
- }
- seqs_map_.clear();
- timers_map_.clear();
- }
-}
-
-void RTCProducerSocket::onInterest(Interest::Ptr &&interest) {
- uint32_t interestSeg = interest->getName().getSuffix();
- uint32_t lifetime = interest->getLifetime();
-
- if (on_interest_input_) {
- on_interest_input_(*getInterface(), *interest);
- }
-
- uint64_t now = std::chrono::duration_cast<std::chrono::milliseconds>(
- std::chrono::steady_clock::now().time_since_epoch())
- .count();
-
- if (interestSeg > HICN_MAX_DATA_SEQ) {
- sendNack(interestSeg);
- return;
- }
-
- const std::shared_ptr<ContentObject> content_object =
- output_buffer_.find(*interest);
-
- if (content_object) {
- if (on_interest_satisfied_output_buffer_) {
- on_interest_satisfied_output_buffer_(*getInterface(), *interest);
- }
-
- if (on_content_object_output_) {
- on_content_object_output_(*getInterface(), *content_object);
- }
-
- TRANSPORT_LOGD("Send content %u (onInterest)",
- content_object->getName().getSuffix());
- portal_->sendContentObject(*content_object);
- return;
- } else {
- if (on_interest_process_) {
- on_interest_process_(*getInterface(), *interest);
- }
- }
-
- // if the production rate is less than MIN_PRODUCTION_RATE we put the
- // interest in a queue, otherwise we handle it in the usual way
- if (packetsProductionRate_.load() < MIN_PRODUCTION_RATE &&
- interestSeg >= currentSeg_.load()) {
- utils::SpinLock::Acquire locked(interests_cache_lock_);
-
- uint64_t next_timer = ~0;
- if (!timers_map_.empty()) {
- next_timer = timers_map_.begin()->first;
- }
-
- uint64_t expiration = now + (lifetime * LIFETIME_FRACTION);
- // check if the seq number exists already
- auto it_seqs = seqs_map_.find(interestSeg);
- if (it_seqs != seqs_map_.end()) {
- // the seq already exists
- if (expiration < it_seqs->second) {
- // we need to update the timer becasue we got a smaller one
- // 1) remove the entry from the multimap
- // 2) update this entry
- auto range = timers_map_.equal_range(it_seqs->second);
- for (auto it_timers = range.first; it_timers != range.second;
- it_timers++) {
- if (it_timers->second == it_seqs->first) {
- timers_map_.erase(it_timers);
- break;
- }
- }
- timers_map_.insert(
- std::pair<uint64_t, uint32_t>(expiration, interestSeg));
- it_seqs->second = expiration;
- } else {
- // nothing to do here
- return;
- }
- } else {
- // add the new seq
- timers_map_.insert(
- std::pair<uint64_t, uint32_t>(expiration, interestSeg));
- seqs_map_.insert(std::pair<uint32_t, uint64_t>(interestSeg, expiration));
- }
-
- // here we have at least one interest in the queue, we need to start or
- // update the timer
- if (!timer_on_) {
- // set timeout
- timer_on_ = true;
- scheduleCacheTimer(timers_map_.begin()->first - now);
- } else {
- // re-schedule the timer because a new interest will expires sooner
- if (next_timer > timers_map_.begin()->first) {
- interests_cache_timer_->cancel();
- scheduleCacheTimer(timers_map_.begin()->first - now);
- }
- }
- return;
- }
-
- uint32_t max_gap = (uint32_t)floor(
- (double)((double)((double)lifetime * INTEREST_LIFETIME_REDUCTION_FACTOR /
- 1000.0) *
- (double)packetsProductionRate_.load()));
-
- if (interestSeg < currentSeg_.load() ||
- interestSeg > (max_gap + currentSeg_.load())) {
- sendNack(interestSeg);
- }
- // else drop packet
-}
-
-void RTCProducerSocket::scheduleCacheTimer(uint64_t wait) {
- interests_cache_timer_->expires_from_now(std::chrono::milliseconds(wait));
- interests_cache_timer_->async_wait([this](std::error_code ec) {
- if (ec) return;
- interestCacheTimer();
- });
-}
-
-void RTCProducerSocket::interestCacheTimer() {
- uint64_t now = std::chrono::duration_cast<std::chrono::milliseconds>(
- std::chrono::steady_clock::now().time_since_epoch())
- .count();
-
- utils::SpinLock::Acquire locked(interests_cache_lock_);
-
- for (auto it_timers = timers_map_.begin(); it_timers != timers_map_.end();) {
- uint64_t expire = it_timers->first;
- if (expire <= now) {
- uint32_t seq = it_timers->second;
- sendNack(seq);
- // remove the interest from the other map
- seqs_map_.erase(seq);
- it_timers = timers_map_.erase(it_timers);
- } else {
- // stop, we are done!
- break;
- }
- }
- if (timers_map_.empty()) {
- timer_on_ = false;
- } else {
- timer_on_ = true;
- scheduleCacheTimer(timers_map_.begin()->first - now);
- }
-}
-
-void RTCProducerSocket::sendNack(uint32_t sequence) {
- auto nack_payload = utils::MemBuf::create(NACK_HEADER_SIZE);
- nack_payload->append(NACK_HEADER_SIZE);
- ContentObject nack;
-
- Name n(flowName_);
- nack.appendPayload(std::move(nack_payload));
- nack.setName(n.setSuffix(sequence));
-
- uint32_t *payload_ptr = (uint32_t *)nack.getPayload()->data();
- *payload_ptr = currentSeg_.load();
-
- *(++payload_ptr) = bytesProductionRate_.load();
-
- nack.setLifetime(0);
- nack.setPathLabel(prodLabel_);
-
- if (on_content_object_output_) {
- on_content_object_output_(*getInterface(), nack);
- }
-
- TRANSPORT_LOGD("Send nack %u", sequence);
- portal_->sendContentObject(nack);
-}
-
-} // namespace implementation
-
-} // end namespace transport
diff --git a/libtransport/src/implementation/rtc_socket_producer.h b/libtransport/src/implementation/rtc_socket_producer.h
deleted file mode 100644
index 87db2121d..000000000
--- a/libtransport/src/implementation/rtc_socket_producer.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2017-2019 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <implementation/socket_producer.h>
-#include <utils/content_store.h>
-
-#include <atomic>
-#include <map>
-#include <mutex>
-
-namespace transport {
-namespace implementation {
-
-class RTCProducerSocket : virtual public ProducerSocket {
- public:
- RTCProducerSocket(interface::ProducerSocket *producer_socket);
-
- ~RTCProducerSocket();
-
- void registerPrefix(const Prefix &producer_namespace) override;
- void produce(std::unique_ptr<utils::MemBuf> &&buffer) override;
-
- private:
- void onInterest(Interest::Ptr &&interest) override;
- void sendNack(uint32_t sequence);
- void updateStats();
- void scheduleCacheTimer(uint64_t wait);
- void scheduleRoundTimer();
- void interestCacheTimer();
-
- std::atomic<uint32_t> currentSeg_;
- uint32_t prodLabel_;
- uint16_t headerSize_;
- Name flowName_;
- std::atomic<uint32_t> producedBytes_;
- std::atomic<uint32_t> producedPackets_;
- std::atomic<uint32_t> bytesProductionRate_;
- std::atomic<uint32_t> packetsProductionRate_;
- uint32_t perSecondFactor_;
-
- std::unique_ptr<asio::steady_timer> round_timer_;
-
- // 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_;
-};
-
-} // namespace implementation
-
-} // end namespace transport
diff --git a/libtransport/src/implementation/socket_consumer.h b/libtransport/src/implementation/socket_consumer.h
index a7b6ac4e7..e0981af7f 100644
--- a/libtransport/src/implementation/socket_consumer.h
+++ b/libtransport/src/implementation/socket_consumer.h
@@ -15,10 +15,10 @@
#pragma once
+#include <hicn/transport/auth/verifier.h>
#include <hicn/transport/interfaces/socket_consumer.h>
#include <hicn/transport/interfaces/socket_options_default_values.h>
#include <hicn/transport/interfaces/statistics.h>
-#include <hicn/transport/auth/verifier.h>
#include <hicn/transport/utils/event_thread.h>
#include <protocols/cbr.h>
#include <protocols/raaqm.h>
@@ -777,7 +777,7 @@ class ConsumerSocket : public Socket {
// Verification parameters
std::shared_ptr<auth::Verifier> verifier_;
- PARCKeyId *key_id_;
+ transport::auth::KeyId *key_id_;
std::atomic_bool verify_signature_;
bool reset_window_;
diff --git a/libtransport/src/implementation/socket_producer.h b/libtransport/src/implementation/socket_producer.h
index f511f7743..9daf79b9d 100644
--- a/libtransport/src/implementation/socket_producer.h
+++ b/libtransport/src/implementation/socket_producer.h
@@ -51,7 +51,7 @@ class ProducerSocket : public Socket {
content_object_expiry_time_(default_values::content_object_expiry_time),
async_thread_(),
making_manifest_(false),
- hash_algorithm_(auth::CryptoHashType::SHA_256),
+ hash_algorithm_(auth::CryptoHashType::SHA256),
suffix_strategy_(core::NextSegmentCalculationStrategy::INCREMENTAL),
on_interest_input_(VOID_HANDLER),
on_interest_dropped_input_buffer_(VOID_HANDLER),
@@ -417,7 +417,7 @@ class ProducerSocket : public Socket {
uint32_t &socket_option_value) {
switch (socket_option_key) {
case GeneralTransportOptions::OUTPUT_BUFFER_SIZE:
- socket_option_value = (uint32_t)production_protocol_->getOutputBufferSize();
+ socket_option_value = production_protocol_->getOutputBufferSize();
break;
case GeneralTransportOptions::DATA_PACKET_SIZE:
diff --git a/libtransport/src/implementation/tls_rtc_socket_producer.cc b/libtransport/src/implementation/tls_rtc_socket_producer.cc
index 9a62c8683..db62b10c1 100644
--- a/libtransport/src/implementation/tls_rtc_socket_producer.cc
+++ b/libtransport/src/implementation/tls_rtc_socket_producer.cc
@@ -156,7 +156,7 @@ void TLSRTCProducerSocket::accept() {
throw errors::RuntimeException("Unable to perform client handshake");
}
- TRANSPORT_LOGD("Handshake performed!");
+ DLOG_IF(INFO, VLOG_IS_ON(2)) << "Handshake performed!";
parent_->list_producers.push_front(
std::move(parent_->map_producers[handshake_name_]));
diff --git a/libtransport/src/implementation/tls_socket_producer.cc b/libtransport/src/implementation/tls_socket_producer.cc
index dd92e58cf..3992ca45c 100644
--- a/libtransport/src/implementation/tls_socket_producer.cc
+++ b/libtransport/src/implementation/tls_socket_producer.cc
@@ -48,13 +48,13 @@ int TLSProducerSocket::readOld(BIO *b, char *buf, int size) {
std::unique_lock<std::mutex> lck(socket->mtx_);
- TRANSPORT_LOGD("Start wait on the CV.");
+ DLOG_IF(INFO, VLOG_IS_ON(4)) << "Start wait on the CV.";
if (!socket->something_to_read_) {
(socket->cv_).wait(lck);
}
- TRANSPORT_LOGD("CV unlocked.");
+ DLOG_IF(INFO, VLOG_IS_ON(4)) << "CV unlocked.";
/* Either there already is something to read, or the thread has been waken up.
* We must return the payload in the interest anyway */
@@ -253,7 +253,7 @@ void TLSProducerSocket::accept() {
}
handshake_state_ = SERVER_FINISHED;
- TRANSPORT_LOGD("Handshake performed!");
+ DLOG_IF(INFO, VLOG_IS_ON(2)) << "Handshake performed!";
}
int TLSProducerSocket::async_accept() {
@@ -305,7 +305,7 @@ void TLSProducerSocket::cacheMiss(interface::ProducerSocket &p,
Interest &interest) {
HandshakeState handshake_state = getHandshakeState();
- TRANSPORT_LOGD("On cache miss in TLS socket producer.");
+ DLOG_IF(INFO, VLOG_IS_ON(3)) << "On cache miss in TLS socket producer.";
if (handshake_state == CLIENT_HELLO) {
std::unique_lock<std::mutex> lck(mtx_);
@@ -390,7 +390,8 @@ int TLSProducerSocket::addHicnKeyIdCb(SSL *s, unsigned int ext_type,
void *add_arg) {
TLSProducerSocket *socket = reinterpret_cast<TLSProducerSocket *>(add_arg);
- TRANSPORT_LOGD("On addHicnKeyIdCb, for the prefix registration.");
+ DLOG_IF(INFO, VLOG_IS_ON(3))
+ << "On addHicnKeyIdCb, for the prefix registration.";
if (ext_type == 100) {
auto &prefix =