aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/http-proxy/includes/hicn/http-proxy/http_proxy.h3
-rw-r--r--libtransport/src/implementation/socket_consumer.h1
-rw-r--r--libtransport/src/protocols/protocol.cc11
-rw-r--r--libtransport/src/protocols/rtc.cc26
-rw-r--r--libtransport/src/protocols/rtc.h3
5 files changed, 20 insertions, 24 deletions
diff --git a/apps/http-proxy/includes/hicn/http-proxy/http_proxy.h b/apps/http-proxy/includes/hicn/http-proxy/http_proxy.h
index 6b5b1c3e..15a46884 100644
--- a/apps/http-proxy/includes/hicn/http-proxy/http_proxy.h
+++ b/apps/http-proxy/includes/hicn/http-proxy/http_proxy.h
@@ -33,7 +33,8 @@ class TcpListener {
TcpListener(asio::io_service& io_service, short port, AcceptCallback callback)
: acceptor_(io_service,
- asio::ip::tcp::endpoint(asio::ip::tcp::v4(), port)),
+ asio::ip::tcp::endpoint(
+ asio::ip::address::from_string("127.0.0.1"), port)),
#if ((ASIO_VERSION / 100 % 1000) < 12)
socket_(io_service),
#endif
diff --git a/libtransport/src/implementation/socket_consumer.h b/libtransport/src/implementation/socket_consumer.h
index 17567820..5e507395 100644
--- a/libtransport/src/implementation/socket_consumer.h
+++ b/libtransport/src/implementation/socket_consumer.h
@@ -54,6 +54,7 @@ class ConsumerSocket : public Socket<BasePortal> {
rate_estimation_observer_(nullptr),
rate_estimation_batching_parameter_(default_values::batch),
rate_estimation_choice_(0),
+ is_async_(false),
verifier_(std::make_shared<utils::Verifier>()),
verify_signature_(false),
key_content_(false),
diff --git a/libtransport/src/protocols/protocol.cc b/libtransport/src/protocols/protocol.cc
index d1bd566a..451fef80 100644
--- a/libtransport/src/protocols/protocol.cc
+++ b/libtransport/src/protocols/protocol.cc
@@ -48,12 +48,6 @@ int TransportProtocol::start() {
// If the protocol is already running, return otherwise set as running
if (is_running_) return -1;
- // Reset the protocol state machine
- reset();
-
- // Set it is the first time we schedule an interest
- is_first_ = true;
-
// Get all callbacks references before starting
socket_->getSocketOption(ConsumerCallbacksOptions::INTEREST_RETRANSMISSION,
&on_interest_retransmission_);
@@ -75,6 +69,11 @@ int TransportProtocol::start() {
&on_payload_);
socket_->getSocketOption(GeneralTransportOptions::ASYNC_MODE, is_async_);
+ // Set it is the first time we schedule an interest
+ is_first_ = true;
+
+ // Reset the protocol state machine
+ reset();
// Schedule next interests
scheduleNextInterests();
diff --git a/libtransport/src/protocols/rtc.cc b/libtransport/src/protocols/rtc.cc
index 3b10c746..b1502f51 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) {
diff --git a/libtransport/src/protocols/rtc.h b/libtransport/src/protocols/rtc.h
index a12c96b6..9f1bcc25 100644
--- a/libtransport/src/protocols/rtc.h
+++ b/libtransport/src/protocols/rtc.h
@@ -93,7 +93,7 @@ class RTCTransportProtocol : public TransportProtocol,
~RTCTransportProtocol();
- int start() override;
+ using TransportProtocol::start;
using TransportProtocol::stop;
@@ -103,6 +103,7 @@ class RTCTransportProtocol : public TransportProtocol,
private:
// algo functions
+ void initParams();
void reset() override;
// CC functions