summaryrefslogtreecommitdiffstats
path: root/libtransport/src/protocols/prod_protocol_rtc.cc
diff options
context:
space:
mode:
authorAngelo Mantellini <manangel@cisco.com>2021-04-30 12:26:57 +0200
committerAngelo Mantellini <angelo.mantellini@cisco.com>2021-04-30 14:54:00 +0200
commit07133ac060c2af721941f7b47c52c075df3168ba (patch)
treea3a618442fc9f1adb5f1cf2e3d442c70fd787d2b /libtransport/src/protocols/prod_protocol_rtc.cc
parent39e15ebb3805efb6c71a1dd16f18061cd86487cf (diff)
[HICN-703] Update windows-sdk and hicn code
Signed-off-by: Angelo Mantellini <@ngelo.mantellini@cisco.com> Change-Id: I05e4c92ce7de3640f0272afae127e1377862bd3e Signed-off-by: Angelo Mantellini <angelo.mantellini@cisco.com>
Diffstat (limited to 'libtransport/src/protocols/prod_protocol_rtc.cc')
-rw-r--r--libtransport/src/protocols/prod_protocol_rtc.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/libtransport/src/protocols/prod_protocol_rtc.cc b/libtransport/src/protocols/prod_protocol_rtc.cc
index 8081923e3..049752876 100644
--- a/libtransport/src/protocols/prod_protocol_rtc.cc
+++ b/libtransport/src/protocols/prod_protocol_rtc.cc
@@ -90,8 +90,8 @@ void RTCProductionProtocol::updateStats() {
uint32_t prev_packets_production_rate = packets_production_rate_;
- bytes_production_rate_ = ceil((double)produced_bytes_ * per_second);
- packets_production_rate_ = ceil((double)produced_packets_ * per_second);
+ bytes_production_rate_ = (uint32_t)ceil((double)produced_bytes_ * per_second);
+ packets_production_rate_ = (uint32_t)ceil((double)produced_packets_ * per_second);
TRANSPORT_LOGD("Updating production rate: produced_bytes_ = %u bps = %u",
produced_bytes_, bytes_production_rate_);
@@ -99,7 +99,7 @@ void RTCProductionProtocol::updateStats() {
// update the production rate as soon as it increases by 10% with respect to
// the last round
max_packet_production_ =
- produced_packets_ + ceil((double)produced_packets_ * 0.1);
+ produced_packets_ + (uint32_t)ceil((double)produced_packets_ * 0.1);
if (max_packet_production_ < rtc::WIN_MIN)
max_packet_production_ = rtc::WIN_MIN;
@@ -189,8 +189,8 @@ void RTCProductionProtocol::produceInternal(
content_object->setPathLabel(prod_label_);
// update stats
- produced_bytes_ +=
- content_object->headerSize() + content_object->payloadSize();
+ produced_bytes_ += (uint32_t)(
+ content_object->headerSize() + content_object->payloadSize());
produced_packets_++;
if (produced_packets_ >= max_packet_production_) {
@@ -318,14 +318,14 @@ void RTCProductionProtocol::onInterest(Interest &interest) {
if (!consumer_in_sync_ && on_consumer_in_sync_) {
// we consider the remote consumer to be in sync as soon as it covers 70%
// of the production window with interests
- uint32_t perc = ceil((double)max_gap * 0.7);
+ uint32_t perc = (uint32_t)ceil((double)max_gap * 0.7);
if (interest_seg > (perc + current_seg_)) {
consumer_in_sync_ = true;
on_consumer_in_sync_(*socket_->getInterface(), interest);
}
}
- uint64_t expiration =
- now + floor((double)lifetime * rtc::INTEREST_LIFETIME_REDUCTION_FACTOR);
+ uint64_t expiration =(uint32_t)(
+ now + floor((double)lifetime * rtc::INTEREST_LIFETIME_REDUCTION_FACTOR));
addToInterestQueue(interest_seg, expiration);
}
}
@@ -377,7 +377,7 @@ void RTCProductionProtocol::sendNacksForPendingInterests() {
uint32_t packet_gap = 100000; // set it to a high value (100sec)
if (packets_production_rate_ != 0)
- packet_gap = ceil(rtc::MILLI_IN_A_SEC / (double)packets_production_rate_);
+ packet_gap = (uint32_t)ceil(rtc::MILLI_IN_A_SEC / (double)packets_production_rate_);
uint64_t now = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::steady_clock::now().time_since_epoch())