aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport
diff options
context:
space:
mode:
authormichele papalini <micpapal@cisco.com>2019-10-04 15:16:57 +0200
committermichele papalini <micpapal@cisco.com>2019-10-04 15:16:57 +0200
commit85a791ac2cdd35d79c00141e748b4c68fbdafb0d (patch)
treea1ec22c004480dc2d963c7b211179a24e505dea7 /libtransport
parent821979b92ea43e82782c26c7372f65955e8b4c9d (diff)
[HICN-296] handle first packet received in RTC consumer socket
Change-Id: I2edb971f43ed4ad2165349345999a7af871323da Signed-off-by: michele papalini <micpapal@cisco.com>
Diffstat (limited to 'libtransport')
-rw-r--r--libtransport/src/hicn/transport/protocols/rtc.cc32
-rw-r--r--libtransport/src/hicn/transport/protocols/rtc.h1
2 files changed, 31 insertions, 2 deletions
diff --git a/libtransport/src/hicn/transport/protocols/rtc.cc b/libtransport/src/hicn/transport/protocols/rtc.cc
index acdf15639..b3a00c58d 100644
--- a/libtransport/src/hicn/transport/protocols/rtc.cc
+++ b/libtransport/src/hicn/transport/protocols/rtc.cc
@@ -99,6 +99,7 @@ void RTCTransportProtocol::reset() {
}
// stats
+ firstPckReceived_ = false;
receivedBytes_ = 0;
sentInterest_ = 0;
receivedData_ = 0;
@@ -446,8 +447,23 @@ void RTCTransportProtocol::scheduleNextInterests() {
socket_->getSocketOption(GeneralTransportOptions::NETWORK_NAME,
&interest_name);
+ interest_name->setSuffix(actualSegment_);
+
+ // if the producer socket is not stated (does not reply even with nacks)
+ // we keep asking for something without marking anything as lost (see
+ // timeout). In this way when the producer socket will start the
+ //consumer socket will not miss any packet
+ if(TRANSPORT_EXPECT_FALSE(!firstPckReceived_)){
+ uint32_t pkt = actualSegment_ & modMask_;
+ inflightInterests_[pkt].state = sent_;
+ inflightInterests_[pkt].sequence = actualSegment_;
+ actualSegment_ = (actualSegment_ + 1) % HICN_MIN_PROBE_SEQ;
+ sendInterest(interest_name, false);
+ return;
+ }
+
// we send the packet only if it is not pending yet
- interest_name->setSuffix(actualSegment_);
+ // notice that this is not true for rtx packets
if (portal_->interestIsPending(*interest_name)) {
actualSegment_ = (actualSegment_ + 1) % HICN_MIN_PROBE_SEQ;
continue;
@@ -616,12 +632,20 @@ void RTCTransportProtocol::onTimeout(Interest::Ptr &&interest) {
uint32_t segmentNumber = interest->getName().getSuffix();
if(segmentNumber >= HICN_MIN_PROBE_SEQ){
- //this is a timeout on a probe, do nothing
+ // this is a timeout on a probe, do nothing
return;
}
uint32_t pkt = segmentNumber & modMask_;
+ if(TRANSPORT_EXPECT_FALSE(!firstPckReceived_)){
+ inflightInterestsCount_--;
+ // we do nothing, and we keep asking the same stuff over
+ // and over until we get at least a packet
+ scheduleNextInterests();
+ return;
+ }
+
if (inflightInterests_[pkt].state == sent_) {
inflightInterestsCount_--;
}
@@ -739,6 +763,10 @@ bool RTCTransportProtocol::onNack(const ContentObject &content_object, bool rtx)
void RTCTransportProtocol::onContentObject(
Interest::Ptr &&interest, ContentObject::Ptr &&content_object) {
+
+ // as soon as we get a packet firstPckReceived_ will never be false
+ firstPckReceived_ = true;
+
auto payload = content_object->getPayload();
uint32_t payload_size = (uint32_t)payload->length();
uint32_t segmentNumber = content_object->getName().getSuffix();
diff --git a/libtransport/src/hicn/transport/protocols/rtc.h b/libtransport/src/hicn/transport/protocols/rtc.h
index 770768e31..4ebae2b90 100644
--- a/libtransport/src/hicn/transport/protocols/rtc.h
+++ b/libtransport/src/hicn/transport/protocols/rtc.h
@@ -183,6 +183,7 @@ class RTCTransportProtocol : public TransportProtocol, public Reassembly {
uint32_t modMask_;
// stats
+ bool firstPckReceived_;
uint32_t receivedBytes_;
uint32_t sentInterest_;
uint32_t receivedData_;