From f108ec82eaf804b3c5d3ee242c02be8d5a72c8d6 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil <33750417+thattil@users.noreply.github.com> Date: Thu, 17 Nov 2022 15:22:54 +0100 Subject: [PATCH] destruct arping thread in Arping desturctor (#578) --- slsReceiverSoftware/src/Arping.cpp | 9 +++++++++ slsReceiverSoftware/src/Arping.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/slsReceiverSoftware/src/Arping.cpp b/slsReceiverSoftware/src/Arping.cpp index a476dba39..01330a216 100644 --- a/slsReceiverSoftware/src/Arping.cpp +++ b/slsReceiverSoftware/src/Arping.cpp @@ -14,6 +14,15 @@ namespace sls { #define gettid() syscall(SYS_gettid) #endif + +Arping::Arping(){} + +Arping::~Arping() { + if (IsRunning()) { + StopThread(); + } +} + void Arping::SetInterfacesAndIps(const int index, const std::string &interface, const std::string &ip) { diff --git a/slsReceiverSoftware/src/Arping.h b/slsReceiverSoftware/src/Arping.h index 80af8d1c5..4a4571605 100644 --- a/slsReceiverSoftware/src/Arping.h +++ b/slsReceiverSoftware/src/Arping.h @@ -17,6 +17,9 @@ namespace sls { class Arping { public: + Arping(); + ~Arping(); + void SetInterfacesAndIps(const int index, const std::string &interface, const std::string &ip); pid_t GetThreadId() const;