summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 76ab5d9..1a9b065 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -11,7 +11,7 @@
#endif
#include <atomic>
-#include <signal.h>
+#include <csignal>
#ifdef USE_DATABASE
# include <litesql.hpp>
#endif
@@ -99,7 +99,7 @@ int main(int ac, char** av)
// Block the signals we want to manage. They will be unblocked only during
// the epoll_pwait or ppoll calls. This avoids some race conditions,
// explained in man 2 pselect on linux
- sigset_t mask;
+ sigset_t mask{};
sigemptyset(&mask);
sigaddset(&mask, SIGINT);
sigaddset(&mask, SIGTERM);
@@ -179,19 +179,20 @@ int main(int ac, char** av)
{
if (xmpp_component->ever_auth)
{
+ static const std::string reconnect_name{"XMPP reconnection"};
if (xmpp_component->first_connection_try == true)
{ // immediately re-try to connect
xmpp_component->reset();
xmpp_component->start();
}
- else
+ else if (!TimedEventsManager::instance().find_event(reconnect_name))
{ // Re-connecting failed, we now try only each few seconds
auto reconnect_later = [xmpp_component]()
{
xmpp_component->reset();
xmpp_component->start();
};
- TimedEvent event(std::chrono::steady_clock::now() + 2s, reconnect_later, "XMPP reconnection");
+ TimedEvent event(std::chrono::steady_clock::now() + 2s, reconnect_later, reconnect_name);
TimedEventsManager::instance().add_event(std::move(event));
}
}