Skip to content
Snippets Groups Projects
Commit 04be8c80 authored by Hoop77's avatar Hoop77
Browse files

-

parent 817e2726
No related merge requests found
......@@ -52,6 +52,7 @@ protected:
Ptr shared_from_this();
private:
static constexpr networking::time::Duration RESPONSE_TIMEOUT = std::chrono::milliseconds(3000);
static constexpr networking::time::Duration HEARTBEAT_INTERVAL = std::chrono::milliseconds(50);
static constexpr networking::time::Duration BROADCAST_TIMEOUT = std::chrono::milliseconds(500);
......
......@@ -13,6 +13,7 @@ using namespace std::chrono_literals;
constexpr networking::time::Duration FollowerVehicle::HEARTBEAT_INTERVAL;
constexpr networking::time::Duration FollowerVehicle::BROADCAST_TIMEOUT;
constexpr networking::time::Duration FollowerVehicle::RESPONSE_TIMEOUT;
FollowerVehicle::Ptr FollowerVehicle::create(networking::Networking & net, const NetworkInfo & info)
{
......@@ -116,9 +117,12 @@ void FollowerVehicle::sendPlatoonCreateRequestToNextVehicle()
// Create a new one to make sure we're never getting a busy exception.
responseTimer = networking::time::Timer::create(net);
responseTimer->startTimeout(
3s,
RESPONSE_TIMEOUT,
[self]
{ self->sendPlatoonCreateRequestToNextVehicle(); });
{
log("Response Timeout!\n");
self->sendPlatoonCreateRequestToNextVehicle();
});
utils::cycle(vehiclesToRequestIter, vehiclesToRequest);
}
......@@ -208,6 +212,8 @@ void FollowerVehicle::receiveResponse(const PlatoonMessage & response)
response.srcVehicle != *vehiclesToRequestIter)
return;
log("Received response!\n");
responseTimer->stop();
waitingForResponse = false;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment