aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/protocols/rtc.cc
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2020-06-09 00:03:15 +0200
committerMauro Sardara <msardara@cisco.com>2020-06-09 01:15:22 +0200
commita84ff82bb37ac53f20639d6e5e7f19d002459f31 (patch)
treee2ff9697793c320aaf17da2dd24b3611d64aa112 /libtransport/src/protocols/rtc.cc
parent37819ae5a3631afc8329d05d73ead9091fc513b3 (diff)
[HICN-623] Initialize is_async in ConsumerSocket constructor.
Also force transports to use base method TransportProtocol::start() instead of redefining their own start(), in order to have the callbacks and the boolean is_async_ initialized upon protocol start. Signed-off-by: Mauro Sardara <msardara@cisco.com> Change-Id: I780b26cca5b8dc59f0def5c08a032bbc90371acd Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'libtransport/src/protocols/rtc.cc')
-rw-r--r--libtransport/src/protocols/rtc.cc26
1 files changed, 10 insertions, 16 deletions
diff --git a/libtransport/src/protocols/rtc.cc b/libtransport/src/protocols/rtc.cc
index 3b10c7467..b1502f51f 100644
--- a/libtransport/src/protocols/rtc.cc
+++ b/libtransport/src/protocols/rtc.cc
@@ -38,24 +38,11 @@ RTCTransportProtocol::RTCTransportProtocol(
sentinel_timer_ =
std::make_unique<asio::steady_timer>(portal_->getIoService());
round_timer_ = std::make_unique<asio::steady_timer>(portal_->getIoService());
- reset();
+ initParams();
}
RTCTransportProtocol::~RTCTransportProtocol() {}
-int RTCTransportProtocol::start() {
- if (is_running_) return -1;
-
- reset();
- is_first_ = true;
-
- probeRtt();
- sentinelTimer();
- newRound();
-
- return TransportProtocol::start();
-}
-
void RTCTransportProtocol::resume() {
if (is_running_) return;
@@ -72,7 +59,7 @@ void RTCTransportProtocol::resume() {
}
// private
-void RTCTransportProtocol::reset() {
+void RTCTransportProtocol::initParams() {
portal_->setConsumerCallback(this);
// controller var
currentState_ = HICN_RTC_SYNC_STATE;
@@ -125,7 +112,14 @@ void RTCTransportProtocol::reset() {
socket_->setSocketOption(GeneralTransportOptions::INTEREST_LIFETIME,
(uint32_t)HICN_RTC_INTEREST_LIFETIME);
- // XXX this should be done by the application
+}
+
+// private
+void RTCTransportProtocol::reset() {
+ initParams();
+ probeRtt();
+ sentinelTimer();
+ newRound();
}
uint32_t max(uint32_t a, uint32_t b) {