From c7d3f56c1edd0af9cbf4cfbd54c1cb7d3bfb1f7a Mon Sep 17 00:00:00 2001 From: Andrea Bondavalli Date: Thu, 30 Sep 2021 12:46:09 +0200 Subject: [PATCH 1/3] Fix for #50: skip setting a source announce period to 0 in case we receive multiple aanoucements packets from a SAP source in a period shorter than 1 second --- daemon/browser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/daemon/browser.cpp b/daemon/browser.cpp index d5835c9..c6c1ed9 100644 --- a/daemon/browser.cpp +++ b/daemon/browser.cpp @@ -100,7 +100,9 @@ bool Browser::worker() { uint32_t last_seen = duration_cast(steady_clock::now() - startup_).count(); auto upd_source{*it}; - upd_source.announce_period = last_seen - upd_source.last_seen; + if ((last_seen - upd_source.last_seen) != 0) { + upd_source.announce_period = last_seen - upd_source.last_seen; + } upd_source.last_seen = last_seen; sources_.replace(it, upd_source); } else { From 52f6990a7ab08ec4328e5ff09242d2a2493de4a0 Mon Sep 17 00:00:00 2001 From: Andrea Bondavalli Date: Thu, 30 Sep 2021 19:03:45 +0200 Subject: [PATCH 2/3] Fix issue-50: don't update the browser record in case we receive multiple annoucements packets from a SAP source in a period shorter than 1 second --- daemon/browser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daemon/browser.cpp b/daemon/browser.cpp index c6c1ed9..3636678 100644 --- a/daemon/browser.cpp +++ b/daemon/browser.cpp @@ -102,9 +102,9 @@ bool Browser::worker() { auto upd_source{*it}; if ((last_seen - upd_source.last_seen) != 0) { upd_source.announce_period = last_seen - upd_source.last_seen; + upd_source.last_seen = last_seen; + sources_.replace(it, upd_source); } - upd_source.last_seen = last_seen; - sources_.replace(it, upd_source); } else { BOOST_LOG_TRIVIAL(info) << "browser:: removing SAP source " << it->id << " name " << it->name; From 4381260ffaac7f191a24925538697e58476b7917 Mon Sep 17 00:00:00 2001 From: Andrea Bondavalli Date: Thu, 30 Sep 2021 19:08:32 +0200 Subject: [PATCH 3/3] Updated daemon version to 1.3 --- daemon/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/main.cpp b/daemon/main.cpp index a73dd4e..1a41d5e 100644 --- a/daemon/main.cpp +++ b/daemon/main.cpp @@ -35,7 +35,7 @@ namespace po = boost::program_options; namespace postyle = boost::program_options::command_line_style; namespace logging = boost::log; -static std::string version("bondagit-1.1-beta"); +static std::string version("bondagit-1.3"); static std::atomic terminate = false; void termination_handler(int signum) {