aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/hicn/transport/protocols/rtc.cc
diff options
context:
space:
mode:
authorAngelo Mantellini <manangel@cisco.com>2019-02-10 12:49:21 +0100
committerAngelo Mantellini <manangel@cisco.com>2019-02-11 14:32:16 +0100
commit4c8876424cca41c8ce8ce67c1c0a394932cbdd58 (patch)
tree03ce5e673a9409b35ba7abf65e1740309ef44653 /libtransport/src/hicn/transport/protocols/rtc.cc
parent731e1188262be87d962f5694022fc74928d889b0 (diff)
[HICN-46] Remove warnings libtransport on windows
Change-Id: I09456770dcbca979491cdcadb310eab95a0dea17 Signed-off-by: Angelo Mantellini <manangel@cisco.com>
Diffstat (limited to 'libtransport/src/hicn/transport/protocols/rtc.cc')
-rw-r--r--libtransport/src/hicn/transport/protocols/rtc.cc69
1 files changed, 35 insertions, 34 deletions
diff --git a/libtransport/src/hicn/transport/protocols/rtc.cc b/libtransport/src/hicn/transport/protocols/rtc.cc
index b8c754c35..dbf1c1bd1 100644
--- a/libtransport/src/hicn/transport/protocols/rtc.cc
+++ b/libtransport/src/hicn/transport/protocols/rtc.cc
@@ -142,11 +142,9 @@ void RTCTransportProtocol::reset() {
protocolState_ = HICN_RTC_NORMAL_STATE;
producerPathLabel_ = 0;
- socket_->setSocketOption(
- GeneralTransportOptions::INTEREST_LIFETIME,
- (uint32_t)
- HICN_RTC_INTEREST_LIFETIME);
- // XXX this should bedone by the application
+ socket_->setSocketOption(GeneralTransportOptions::INTEREST_LIFETIME,
+ (uint32_t)HICN_RTC_INTEREST_LIFETIME);
+ // XXX this should bedone by the application
}
uint32_t max(uint32_t a, uint32_t b) {
@@ -164,9 +162,10 @@ uint32_t min(uint32_t a, uint32_t b) {
}
void RTCTransportProtocol::checkRound() {
- uint32_t duration = std::chrono::duration_cast<std::chrono::milliseconds>(
- std::chrono::steady_clock::now() - lastRoundBegin_)
- .count();
+ uint32_t duration =
+ (uint32_t)std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::steady_clock::now() - lastRoundBegin_)
+ .count();
if (duration >= HICN_ROUND_LEN) {
lastRoundBegin_ = std::chrono::steady_clock::now();
updateStats(duration); // update stats and window
@@ -214,9 +213,9 @@ void RTCTransportProtocol::updateDelayStats(
void RTCTransportProtocol::updateStats(uint32_t round_duration) {
if (receivedBytes_ != 0) {
- double bytesPerSec = (double)(receivedBytes_ *
- ((double) HICN_MILLI_IN_A_SEC /
- (double)round_duration));
+ double bytesPerSec =
+ (double)(receivedBytes_ *
+ ((double)HICN_MILLI_IN_A_SEC / (double)round_duration));
estimatedBw_ = (estimatedBw_ * HICN_ESTIMATED_BW_ALPHA) +
((1 - HICN_ESTIMATED_BW_ALPHA) * bytesPerSec);
}
@@ -259,12 +258,11 @@ void RTCTransportProtocol::updateStats(uint32_t round_duration) {
if (avgPacketSize_ == 0) avgPacketSize_ = HICN_INIT_PACKET_SIZE;
- uint32_t BDP =
- ceil((estimatedBw_ * (double)((double)minRtt_ /
- (double)HICN_MILLI_IN_A_SEC) *
- HICN_BANDWIDTH_SLACK_FACTOR) /
- avgPacketSize_);
- uint32_t BW = ceil(estimatedBw_);
+ uint32_t BDP = (uint32_t)ceil(
+ (estimatedBw_ * (double)((double)minRtt_ / (double)HICN_MILLI_IN_A_SEC) *
+ HICN_BANDWIDTH_SLACK_FACTOR) /
+ avgPacketSize_);
+ uint32_t BW = (uint32_t)ceil(estimatedBw_);
computeMaxWindow(BW, BDP);
// bound also by interest lifitime* production rate
@@ -304,11 +302,11 @@ void RTCTransportProtocol::computeMaxWindow(uint32_t productionRate,
uint32_t interestLifetime = default_values::interest_lifetime;
socket_->getSocketOption(GeneralTransportOptions::INTEREST_LIFETIME,
interestLifetime);
- uint32_t maxWaintingInterest = ceil(
+ uint32_t maxWaintingInterest = (uint32_t)ceil(
(productionRate / avgPacketSize_) *
(double)((double)(interestLifetime *
- HICN_INTEREST_LIFETIME_REDUCTION_FACTOR) /
- (double) HICN_MILLI_IN_A_SEC));
+ HICN_INTEREST_LIFETIME_REDUCTION_FACTOR) /
+ (double)HICN_MILLI_IN_A_SEC));
if (currentState_ == HICN_RTC_SYNC_STATE) {
// in this case we do not limit the window with the BDP, beacuse most likly
@@ -319,7 +317,8 @@ void RTCTransportProtocol::computeMaxWindow(uint32_t productionRate,
// currentState = RTC_NORMAL_STATE
if (BDPWin != 0) {
- maxCWin_ = ceil((double)BDPWin + ((double)BDPWin / 10.0)); // BDP + 10%
+ maxCWin_ =
+ (uint32_t)ceil((double)BDPWin + ((double)BDPWin / 10.0)); // BDP + 10%
} else {
maxCWin_ = min(maxWaintingInterest, maxCWin_);
}
@@ -329,9 +328,11 @@ void RTCTransportProtocol::updateWindow() {
if (currentState_ == HICN_RTC_SYNC_STATE) return;
if (currentCWin_ < maxCWin_ * 0.7) {
- currentCWin_ = min(maxCWin_, currentCWin_ * HICN_WIN_INCREASE_FACTOR);
+ currentCWin_ =
+ min(maxCWin_, (uint32_t)(currentCWin_ * HICN_WIN_INCREASE_FACTOR));
} else if (currentCWin_ > maxCWin_) {
- currentCWin_ = max(currentCWin_ * HICN_WIN_DECREASE_FACTOR, HICN_MIN_CWIN);
+ currentCWin_ =
+ max((uint32_t)(currentCWin_ * HICN_WIN_DECREASE_FACTOR), HICN_MIN_CWIN);
}
}
@@ -340,8 +341,8 @@ void RTCTransportProtocol::decreaseWindow() {
if (currentState_ == HICN_RTC_NORMAL_STATE) return;
if (gotFutureNack_ == 1)
- currentCWin_ =
- min((currentCWin_ - 1), ceil((double)maxCWin_ * 0.66)); // 2/3
+ currentCWin_ = min((currentCWin_ - 1),
+ (uint32_t)ceil((double)maxCWin_ * 0.66)); // 2/3
else
currentCWin_--;
@@ -357,7 +358,8 @@ void RTCTransportProtocol::increaseWindow() {
currentCWin_ = currentCWin_ + 1; // exponential
} else {
currentCWin_ = min(
- maxCWin_, ceil(currentCWin_ + (1.0 / (double)currentCWin_))); // linear
+ maxCWin_,
+ (uint32_t)ceil(currentCWin_ + (1.0 / (double)currentCWin_))); // linear
}
}
@@ -542,7 +544,7 @@ void RTCTransportProtocol::onNack(const ContentObject &content_object) {
void RTCTransportProtocol::onContentObject(
Interest::Ptr &&interest, ContentObject::Ptr &&content_object) {
- uint32_t payload_size = content_object->getPayload().length();
+ uint32_t payload_size = (uint32_t)content_object->getPayload().length();
uint32_t segmentNumber = content_object->getName().getSuffix();
uint32_t pkt = segmentNumber & modMask_;
@@ -558,17 +560,16 @@ void RTCTransportProtocol::onContentObject(
} else {
receivedData_++;
- avgPacketSize_ =
- (HICN_ESTIMATED_PACKET_SIZE * avgPacketSize_) +
- ((1 - HICN_ESTIMATED_PACKET_SIZE) *
- content_object->getPayload().length());
+ avgPacketSize_ = (HICN_ESTIMATED_PACKET_SIZE * avgPacketSize_) +
+ ((1 - HICN_ESTIMATED_PACKET_SIZE) *
+ content_object->getPayload().length());
if (inflightInterests_[pkt].retransmissions == 0) {
inflightInterestsCount_--;
// we count only non retransmitted data in order to take into accunt only
// the transmition rate of the producer
- receivedBytes_ +=
- content_object->headerSize() + content_object->payloadSize();
+ receivedBytes_ += (uint32_t)(content_object->headerSize() +
+ content_object->payloadSize());
updateDelayStats(*content_object);
}
@@ -585,7 +586,7 @@ void RTCTransportProtocol::returnContentToUser(
Array a = content_object.getPayload();
uint8_t *start = ((uint8_t *)a.data()) + HICN_TIMESTAMP_SIZE;
- unsigned size = a.length() - HICN_TIMESTAMP_SIZE;
+ unsigned size = (unsigned)(a.length() - HICN_TIMESTAMP_SIZE);
// set offset between hICN and RTP packets
uint16_t rtp_seq = ntohs(*(((uint16_t *)start) + 1));