From 1bc7b7ad550f1437391566186d4dac488746ab24 Mon Sep 17 00:00:00 2001 From: Henry Winkel Date: Tue, 17 Jan 2023 12:35:18 +0100 Subject: [PATCH] FIX: fixed bug with the leaving and joining from local clients --- include/WHISPER/InternalUDPService.hpp | 2 +- src/WHISPER/InternalUDPService.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/WHISPER/InternalUDPService.hpp b/include/WHISPER/InternalUDPService.hpp index 8292699..4d2cd94 100644 --- a/include/WHISPER/InternalUDPService.hpp +++ b/include/WHISPER/InternalUDPService.hpp @@ -15,7 +15,7 @@ namespace WHISPER { struct localClient{ - short port; + std::uint32_t port; std::string addr; std::uint32_t id; zmq::socket_t clientSocket; diff --git a/src/WHISPER/InternalUDPService.cpp b/src/WHISPER/InternalUDPService.cpp index 2591b28..cb451f2 100644 --- a/src/WHISPER/InternalUDPService.cpp +++ b/src/WHISPER/InternalUDPService.cpp @@ -137,7 +137,7 @@ namespace WHISPER { if (localclients.size() > 0) { for (auto it = localclients.begin(); it != localclients.end();it++) { - if (it->get()->port == join.port) { + if (it->get()->port == join.port || it->get()->id == join.deviceId_) { clientAllreadyIn = true; } } @@ -169,7 +169,7 @@ namespace WHISPER { if (localclients.size() > 0) { for (auto it = localclients.begin(); it != localclients.end();it++) { - if (it->get()->port == Leave.port) { + if (it->get()->port == Leave.port || it->get()->id == Leave.deviceId_) { it->get()->clientSocket.close(); it = localclients.erase(it); LOG_S(INFO)<<"client left";