refactor: ClientApp Replace RETRY_TIME define with constexpr

This commit is contained in:
sithlord48 2025-07-03 12:10:33 -04:00 committed by Nick Bolton
parent 1a9f8d5cdc
commit 4034d15fb3

View file

@ -58,7 +58,7 @@
#include <sstream> #include <sstream>
#include <stdio.h> #include <stdio.h>
#define RETRY_TIME 1.0 constexpr static auto s_retryTime = 1.0;
ClientApp::ClientApp(IEventQueue *events) : App(events, new deskflow::ClientArgs()) ClientApp::ClientApp(IEventQueue *events) : App(events, new deskflow::ClientArgs())
{ {
@ -252,7 +252,7 @@ void ClientApp::handleClientFailed(const Event &e)
updateStatus(std::string("Failed to connect to server: ") + info->m_what + " Trying next address..."); updateStatus(std::string("Failed to connect to server: ") + info->m_what + " Trying next address...");
LOG((CLOG_WARN "failed to connect to server=%s, trying next address", info->m_what.c_str())); LOG((CLOG_WARN "failed to connect to server=%s, trying next address", info->m_what.c_str()));
if (!m_suspended) { if (!m_suspended) {
scheduleClientRestart(RETRY_TIME); scheduleClientRestart(s_retryTime);
} }
} else { } else {
m_lastServerAddressIndex = 0; m_lastServerAddressIndex = 0;
@ -271,7 +271,7 @@ void ClientApp::handleClientRefused(const Event &e)
} else { } else {
LOG((CLOG_WARN "failed to connect to server: %s", info->m_what.c_str())); LOG((CLOG_WARN "failed to connect to server: %s", info->m_what.c_str()));
if (!m_suspended) { if (!m_suspended) {
scheduleClientRestart(RETRY_TIME); scheduleClientRestart(s_retryTime);
} }
} }
} }
@ -282,7 +282,7 @@ void ClientApp::handleClientDisconnected()
if (!args().m_restartable) { if (!args().m_restartable) {
m_events->addEvent(Event(EventTypes::Quit)); m_events->addEvent(Event(EventTypes::Quit));
} else if (!m_suspended) { } else if (!m_suspended) {
scheduleClientRestart(RETRY_TIME); scheduleClientRestart(s_retryTime);
} }
updateStatus(); updateStatus();
} }