From c7d04978f52679c74ca883f3edb19adf997116d7 Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Tue, 19 Mar 2019 16:55:10 +0100 Subject: [HICN-125] Use getPayload once in rtc transport functions. Change-Id: I23532b0609dba5b570c6f269e8f1d9889bcf624c Signed-off-by: Mauro Sardara --- libtransport/src/hicn/transport/protocols/rtc.cc | 11 ++++++----- 1 file 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::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_--; -- cgit 1.2.3-korg