refactor: ClientApp / ServerApp, remove do nothing updateStatus methods and calls

This commit is contained in:
sithlord48 2025-08-03 00:13:43 -04:00 committed by Nick Bolton
parent b2eb3a036d
commit ff1e7f3c9f
4 changed files with 0 additions and 39 deletions

View file

@ -190,16 +190,6 @@ deskflow::Screen *ClientApp::createScreen()
#endif
}
void ClientApp::updateStatus() const
{
updateStatus("");
}
void ClientApp::updateStatus(const std::string_view &) const
{
// do nothing
}
deskflow::Screen *ClientApp::openClientScreen()
{
deskflow::Screen *screen = createScreen();
@ -238,7 +228,6 @@ void ClientApp::scheduleClientRestart(double retryTime)
void ClientApp::handleClientConnected() const
{
LOG((CLOG_NOTE "connected to server"));
updateStatus();
}
void ClientApp::handleClientFailed(const Event &e)
@ -246,7 +235,6 @@ void ClientApp::handleClientFailed(const Event &e)
if ((++m_lastServerAddressIndex) < m_client->getLastResolvedAddressesCount()) {
std::unique_ptr<Client::FailInfo> info(static_cast<Client::FailInfo *>(e.getData()));
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()));
if (!m_suspended) {
scheduleClientRestart(s_retryTime);
@ -261,7 +249,6 @@ void ClientApp::handleClientRefused(const Event &e)
{
std::unique_ptr<Client::FailInfo> info(static_cast<Client::FailInfo *>(e.getData()));
updateStatus(std::string("Failed to connect to server: ") + info->m_what);
if (!args().m_restartable || !info->m_retry) {
LOG((CLOG_ERR "failed to connect to server: %s", info->m_what.c_str()));
getEvents()->addEvent(Event(EventTypes::Quit));
@ -281,7 +268,6 @@ void ClientApp::handleClientDisconnected()
} else if (!m_suspended) {
scheduleClientRestart(s_retryTime);
}
updateStatus();
}
Client *ClientApp::openClient(const std::string &name, const NetworkAddress &address, deskflow::Screen *screen)
@ -345,12 +331,10 @@ bool ClientApp::startClient()
m_client->connect(m_lastServerAddressIndex);
updateStatus();
return true;
} catch (XScreenUnavailable &e) {
LOG((CLOG_WARN "secondary screen unavailable: %s", e.what()));
closeClientScreen(clientScreen);
updateStatus(std::string("secondary screen unavailable: ") + e.what());
retryTime = e.getRetryTime();
} catch (XScreenOpenFailure &e) {
LOG((CLOG_CRIT "failed to start client: %s", e.what()));
@ -411,7 +395,6 @@ int ClientApp::mainLoop()
// close down
LOG((CLOG_DEBUG1 "stopping client"));
stopClient();
updateStatus();
LOG((CLOG_NOTE "stopped client"));
return s_exitSuccess;

View file

@ -62,9 +62,6 @@ public:
//
// Regular functions
//
void updateStatus() const;
void updateStatus(const std::string_view &) const;
deskflow::Screen *openClientScreen();
void closeClientScreen(deskflow::Screen *screen);
void handleClientRestart(const Event &, EventQueueTimer *vtimer);

View file

@ -203,7 +203,6 @@ void ServerApp::handleClientConnected(const Event &, ClientListener *listener)
ClientProxy *client = listener->getNextClient();
if (client != nullptr) {
m_server->adoptClient(client);
updateStatus();
}
}
@ -245,16 +244,6 @@ void ServerApp::stopRetryTimer()
}
}
void ServerApp::updateStatus() const
{
updateStatus("");
}
void ServerApp::updateStatus(const std::string_view &msg) const
{
// do nothing
}
void ServerApp::closeClientListener(ClientListener *listen)
{
if (listen != nullptr) {
@ -379,13 +368,11 @@ bool ServerApp::initServer()
m_serverScreen = serverScreen;
m_primaryClient = primaryClient;
m_serverState = Initialized;
updateStatus();
return true;
} catch (XScreenUnavailable &e) {
LOG((CLOG_WARN "primary screen unavailable: %s", e.what()));
closePrimaryClient(primaryClient);
closeServerScreen(serverScreen);
updateStatus(std::string("primary screen unavailable: ") + e.what());
retryTime = e.getRetryTime();
} catch (XScreenOpenFailure &e) {
LOG((CLOG_CRIT "failed to start server: %s", e.what()));
@ -455,7 +442,6 @@ bool ServerApp::startServer()
listener->setServer(m_server);
m_server->setListener(listener);
m_listener = listener;
updateStatus();
LOG((CLOG_NOTE "started server, waiting for clients"));
m_serverState = Started;
return true;
@ -466,7 +452,6 @@ bool ServerApp::startServer()
LOG((CLOG_CRIT "cannot listen for clients: %s", e.what()));
}
closeClientListener(listener);
updateStatus(std::string("cannot listen for clients: ") + e.what());
} catch (XBase &e) {
LOG((CLOG_CRIT "failed to start server: %s", e.what()));
closeClientListener(listener);
@ -562,7 +547,6 @@ Server *ServerApp::openServer(ServerConfig &config, PrimaryClient *primaryClient
{
auto *server = new Server(config, primaryClient, m_serverScreen, getEvents(), args());
try {
getEvents()->addHandler(EventTypes::ServerDisconnected, server, [this](const auto &) { updateStatus(); });
getEvents()->addHandler(EventTypes::ServerScreenSwitched, server, [this](const auto &) { handleScreenSwitched(); });
} catch (std::bad_alloc &ba) {
@ -661,7 +645,6 @@ int ServerApp::mainLoop()
getEvents()->removeHandler(EventTypes::ServerAppForceReconnect, getEvents()->getSystemTarget());
getEvents()->removeHandler(EventTypes::ServerAppReloadConfig, getEvents()->getSystemTarget());
cleanupServer();
updateStatus();
LOG((CLOG_NOTE "stopped server"));
return s_exitSuccess;

View file

@ -87,8 +87,6 @@ public:
void handleClientConnected(const Event &e, ClientListener *listener);
void closeServer(Server *server);
void stopRetryTimer();
void updateStatus() const;
void updateStatus(const std::string_view &msg) const;
void closeClientListener(ClientListener *listen);
void stopServer();
void closePrimaryClient(PrimaryClient *primaryClient);