From 80afb92af1dfc9604005558e965421ea8799a254 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Sun, 20 Apr 2025 10:06:04 -0400 Subject: [PATCH] chore: remove more code for inverse connection related: https://github.com/deskflow/deskflow/pull/8240 --- src/lib/deskflow/ServerApp.cpp | 9 +-------- src/lib/server/ClientListener.cpp | 9 --------- src/lib/server/ClientListener.h | 4 ---- src/lib/server/Config.cpp | 12 ------------ src/lib/server/Config.h | 14 -------------- src/lib/server/Server.cpp | 6 ------ src/lib/server/Server.h | 3 --- 7 files changed, 1 insertion(+), 56 deletions(-) diff --git a/src/lib/deskflow/ServerApp.cpp b/src/lib/deskflow/ServerApp.cpp index a0d62da59..4e6526b47 100644 --- a/src/lib/deskflow/ServerApp.cpp +++ b/src/lib/deskflow/ServerApp.cpp @@ -669,14 +669,7 @@ ISocketFactory *ServerApp::getSocketFactory() const NetworkAddress ServerApp::getAddress(const NetworkAddress &address) const { - if (args().m_config->isClientMode()) { - const auto clientAddress = args().m_config->getClientAddress(); - NetworkAddress addr(clientAddress.c_str(), kDefaultPort); - addr.resolve(); - return addr; - } else { - return address; - } + return address; } int ServerApp::mainLoop() diff --git a/src/lib/server/ClientListener.cpp b/src/lib/server/ClientListener.cpp index a48f4bdf5..120474d6d 100644 --- a/src/lib/server/ClientListener.cpp +++ b/src/lib/server/ClientListener.cpp @@ -122,14 +122,6 @@ void ClientListener::removeUnknownClient(ClientProxyUnknown *unknownClient) } } -void ClientListener::restart() -{ - if (m_server && m_server->isClientMode()) { - stop(); - start(); - } -} - void ClientListener::handleClientConnecting(const Event &, void *) { // accept client connection @@ -213,7 +205,6 @@ void ClientListener::handleUnknownClientFailure(const Event &, void *vclient) { auto unknownClient = static_cast(vclient); removeUnknownClient(unknownClient); - restart(); } void ClientListener::handleClientDisconnected(const Event &, void *vclient) diff --git a/src/lib/server/ClientListener.h b/src/lib/server/ClientListener.h index 0d6c04af4..c2e0071db 100644 --- a/src/lib/server/ClientListener.h +++ b/src/lib/server/ClientListener.h @@ -60,10 +60,6 @@ public: { return m_server; } - - //! This method restarts the listener - void restart(); - //@} private: diff --git a/src/lib/server/Config.cpp b/src/lib/server/Config.cpp index ccae42399..b653e11a0 100644 --- a/src/lib/server/Config.cpp +++ b/src/lib/server/Config.cpp @@ -586,16 +586,6 @@ std::string Config::formatInterval(const Interval &x) return deskflow::string::sprintf("(%d,%d)", (int)(x.first * 100.0f + 0.5f), (int)(x.second * 100.0f + 0.5f)); } -std::string Config::getClientAddress() const -{ - return m_ClientAddress; -} - -bool Config::isClientMode() const -{ - return (!m_ClientAddress.empty()); -} - void Config::readSection(ConfigReadContext &s) { static const char s_section[] = "section:"; @@ -696,8 +686,6 @@ void Config::readSectionOptions(ConfigReadContext &s) addOption("", kOptionClipboardSharing, s.parseBoolean(value)); } else if (name == "clipboardSharingSize") { addOption("", kOptionClipboardSharingSize, s.parseInt(value)); - } else if (name == "clientAddress") { - m_ClientAddress = value; } else { handled = false; } diff --git a/src/lib/server/Config.h b/src/lib/server/Config.h index 71ac82e93..618c1a061 100644 --- a/src/lib/server/Config.h +++ b/src/lib/server/Config.h @@ -462,19 +462,6 @@ public: Returns an interval as a parseable string. */ static std::string formatInterval(const Interval &); - - //! Get client address as a string - /*! - * Return client address a string. - */ - std::string getClientAddress() const; - - //! Return true if server started in client mode - /*! - * In client mode the server initiates connection to client - */ - bool isClientMode() const; - //@} private: @@ -503,7 +490,6 @@ private: InputFilter m_inputFilter; bool m_hasLockToScreenAction; IEventQueue *m_events; - std::string m_ClientAddress; }; //! Configuration read context diff --git a/src/lib/server/Server.cpp b/src/lib/server/Server.cpp index bc2722766..3fd2be163 100644 --- a/src/lib/server/Server.cpp +++ b/src/lib/server/Server.cpp @@ -1334,7 +1334,6 @@ void Server::handleClientDisconnected(const Event &, void *vclient) removeOldClient(client); delete client; - m_clientListener->restart(); } void Server::handleClientCloseTimeout(const Event &, void *vclient) @@ -2251,11 +2250,6 @@ bool Server::isReceivedFileSizeValid() return m_expectedFileSize == m_receivedFileData.size(); } -bool Server::isClientMode() const -{ - return m_args.m_config->isClientMode(); -} - void Server::sendFileToClient(const char *filename) { if (m_sendFileThread != NULL) { diff --git a/src/lib/server/Server.h b/src/lib/server/Server.h index ac06db219..470fd87f4 100644 --- a/src/lib/server/Server.h +++ b/src/lib/server/Server.h @@ -222,9 +222,6 @@ public: return m_fakeDragFileList; } - //! Returns true if it's client mode and server initiates connection - bool isClientMode() const; - //@} private: