From 47a03f2a8cf51418a86809a03d328b39481ba8dd Mon Sep 17 00:00:00 2001
From: Hoop77 <p.badenhoop@gmx.de>
Date: Sun, 21 Jan 2018 19:56:00 +0100
Subject: [PATCH] removed unneccessary functions in Timer.h

---
 NetworkingLib/include/Timer.h           |  4 --
 NetworkingLib/src/Timer.cpp             | 74 +++++++++----------------
 PlatoonProtocol/src/FollowerVehicle.cpp |  2 +-
 3 files changed, 26 insertions(+), 54 deletions(-)

diff --git a/NetworkingLib/include/Timer.h b/NetworkingLib/include/Timer.h
index f026a88d..d1ae35b9 100644
--- a/NetworkingLib/include/Timer.h
+++ b/NetworkingLib/include/Timer.h
@@ -37,10 +37,6 @@ public:
 
     void stop();
 
-    void enable() noexcept;
-
-    bool isEnabled() const noexcept;
-
 private:
     boost::asio::basic_waitable_timer<time::Clock> timer;
     std::atomic<bool> enabled{true};
diff --git a/NetworkingLib/src/Timer.cpp b/NetworkingLib/src/Timer.cpp
index d414ad64..8e1a10b3 100644
--- a/NetworkingLib/src/Timer.cpp
+++ b/NetworkingLib/src/Timer.cpp
@@ -21,49 +21,35 @@ Timer::Ptr Timer::create(Networking & net)
 
 void Timer::startTimeout(const time::Duration & duration, TimeoutHandler handler)
 {
-    try
-    {
-        enabled = true;
-
-        auto self = shared_from_this();
-        timer.expires_from_now(duration);
-        timer.async_wait(
-            [self, handler](const boost::system::error_code & error)
-            {
-                if (error || !self->enabled)
-                    return;
-
-                handler();
-            });
-    }
-    catch (...)
-    {
-        throw error::FailedOperation{};
-    }
+    enabled = true;
+
+    auto self = shared_from_this();
+    timer.expires_from_now(duration);
+    timer.async_wait(
+        [self, handler](const boost::system::error_code & error)
+        {
+            if (error || !self->enabled)
+                return;
+
+            handler();
+        });
 }
 
 void Timer::startPeriodicTimeout(const time::Duration & interval, Timer::TimeoutHandler handler)
 {
-    try
-    {
-        enabled = true;
-
-        auto self = shared_from_this();
-        timer.expires_from_now(interval);
-        timer.async_wait(
-            [self, interval, handler](const boost::system::error_code & error)
-            {
-                if (error || !self->enabled)
-                    return;
-
-                handler();
-                self->nextPeriod(interval, handler);
-            });
-    }
-    catch (...)
-    {
-        throw error::FailedOperation{};
-    }
+    enabled = true;
+
+    auto self = shared_from_this();
+    timer.expires_from_now(interval);
+    timer.async_wait(
+        [self, interval, handler](const boost::system::error_code & error)
+        {
+            if (error || !self->enabled)
+                return;
+
+            handler();
+            self->nextPeriod(interval, handler);
+        });
 }
 
 void Timer::stop()
@@ -76,16 +62,6 @@ void Timer::stop()
     timer.cancel(ignoredError);
 }
 
-void Timer::enable() noexcept
-{
-    enabled = true;
-}
-
-bool Timer::isEnabled() const noexcept
-{
-    return enabled;
-}
-
 void Timer::nextPeriod(const time::Duration & interval, Timer::TimeoutHandler handler)
 {
     if (!enabled)
diff --git a/PlatoonProtocol/src/FollowerVehicle.cpp b/PlatoonProtocol/src/FollowerVehicle.cpp
index 7d9ea87e..9dcb8d4d 100644
--- a/PlatoonProtocol/src/FollowerVehicle.cpp
+++ b/PlatoonProtocol/src/FollowerVehicle.cpp
@@ -114,7 +114,7 @@ void FollowerVehicle::makePlatoonCreateResponse(const networking::Resolver::Endp
 {
     if (state != State::CREATING_PLATOON)
     {
-        response =  PlatoonMessage::rejectResponse(getOwnEndpoint().getVehicleId());
+        response = PlatoonMessage::rejectResponse(getOwnEndpoint().getVehicleId());
         return;
     }
 
-- 
GitLab