aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2019-03-19 16:55:10 +0100
committerMauro Sardara <msardara@cisco.com>2019-03-19 16:58:52 +0100
commitc7d04978f52679c74ca883f3edb19adf997116d7 (patch)
treee6fedf7611dabeabd112f693994278384a6144f0 /libtransport
parent393a0a4018936134fa1b343523bbafaab606973d (diff)
[HICN-125] Use getPayload once in rtc transport functions.
Change-Id: I23532b0609dba5b570c6f269e8f1d9889bcf624c Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'libtransport')
-rw-r--r--libtransport/src/hicn/transport/protocols/rtc.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/libtransport/src/hicn/transport/protocols/rtc.cc b/libtransport/src/hicn/transport/protocols/rtc.cc
index 48ba90f9e..e07a4042b 100644
--- a/libtransport/src/hicn/transport/protocols/rtc.cc
+++ b/libtransport/src/hicn/transport/protocols/rtc.cc
@@ -184,10 +184,11 @@ void RTCTransportProtocol::updateDelayStats(
inflightInterests_[pkt].transmissionTime;
pathTable_[pathLabel]->insertRttSample(RTT);
+ auto payload = content_object.getPayload();
// we collect OWD only for datapackets
- if (content_object.getPayload()->length() != HICN_NACK_HEADER_SIZE) {
- uint64_t *senderTimeStamp = (uint64_t *)content_object.getPayload()->data();
+ if (payload->length() != HICN_NACK_HEADER_SIZE) {
+ uint64_t *senderTimeStamp = (uint64_t *)payload->data();
int64_t OWD = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::system_clock::now().time_since_epoch())
@@ -531,7 +532,8 @@ void RTCTransportProtocol::onNack(const ContentObject &content_object) {
void RTCTransportProtocol::onContentObject(
Interest::Ptr &&interest, ContentObject::Ptr &&content_object) {
- uint32_t payload_size = (uint32_t)content_object->getPayload()->length();
+ auto payload = content_object->getPayload();
+ uint32_t payload_size = (uint32_t)payload->length();
uint32_t segmentNumber = content_object->getName().getSuffix();
uint32_t pkt = segmentNumber & modMask_;
@@ -548,8 +550,7 @@ void RTCTransportProtocol::onContentObject(
receivedData_++;
avgPacketSize_ = (HICN_ESTIMATED_PACKET_SIZE * avgPacketSize_) +
- ((1 - HICN_ESTIMATED_PACKET_SIZE) *
- content_object->getPayload()->length());
+ ((1 - HICN_ESTIMATED_PACKET_SIZE) * payload->length());
if (inflightInterests_[pkt].retransmissions == 0) {
inflightInterestsCount_--;