chore: remove more code for inverse connection
related: https://github.com/deskflow/deskflow/pull/8240
This commit is contained in:
parent
f5f3bc0475
commit
80afb92af1
7 changed files with 1 additions and 56 deletions
|
|
@ -669,14 +669,7 @@ ISocketFactory *ServerApp::getSocketFactory() const
|
||||||
|
|
||||||
NetworkAddress ServerApp::getAddress(const NetworkAddress &address) const
|
NetworkAddress ServerApp::getAddress(const NetworkAddress &address) const
|
||||||
{
|
{
|
||||||
if (args().m_config->isClientMode()) {
|
return address;
|
||||||
const auto clientAddress = args().m_config->getClientAddress();
|
|
||||||
NetworkAddress addr(clientAddress.c_str(), kDefaultPort);
|
|
||||||
addr.resolve();
|
|
||||||
return addr;
|
|
||||||
} else {
|
|
||||||
return address;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ServerApp::mainLoop()
|
int ServerApp::mainLoop()
|
||||||
|
|
|
||||||
|
|
@ -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 *)
|
void ClientListener::handleClientConnecting(const Event &, void *)
|
||||||
{
|
{
|
||||||
// accept client connection
|
// accept client connection
|
||||||
|
|
@ -213,7 +205,6 @@ void ClientListener::handleUnknownClientFailure(const Event &, void *vclient)
|
||||||
{
|
{
|
||||||
auto unknownClient = static_cast<ClientProxyUnknown *>(vclient);
|
auto unknownClient = static_cast<ClientProxyUnknown *>(vclient);
|
||||||
removeUnknownClient(unknownClient);
|
removeUnknownClient(unknownClient);
|
||||||
restart();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientListener::handleClientDisconnected(const Event &, void *vclient)
|
void ClientListener::handleClientDisconnected(const Event &, void *vclient)
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,6 @@ public:
|
||||||
{
|
{
|
||||||
return m_server;
|
return m_server;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! This method restarts the listener
|
|
||||||
void restart();
|
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -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));
|
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)
|
void Config::readSection(ConfigReadContext &s)
|
||||||
{
|
{
|
||||||
static const char s_section[] = "section:";
|
static const char s_section[] = "section:";
|
||||||
|
|
@ -696,8 +686,6 @@ void Config::readSectionOptions(ConfigReadContext &s)
|
||||||
addOption("", kOptionClipboardSharing, s.parseBoolean(value));
|
addOption("", kOptionClipboardSharing, s.parseBoolean(value));
|
||||||
} else if (name == "clipboardSharingSize") {
|
} else if (name == "clipboardSharingSize") {
|
||||||
addOption("", kOptionClipboardSharingSize, s.parseInt(value));
|
addOption("", kOptionClipboardSharingSize, s.parseInt(value));
|
||||||
} else if (name == "clientAddress") {
|
|
||||||
m_ClientAddress = value;
|
|
||||||
} else {
|
} else {
|
||||||
handled = false;
|
handled = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -462,19 +462,6 @@ public:
|
||||||
Returns an interval as a parseable string.
|
Returns an interval as a parseable string.
|
||||||
*/
|
*/
|
||||||
static std::string formatInterval(const Interval &);
|
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:
|
private:
|
||||||
|
|
@ -503,7 +490,6 @@ private:
|
||||||
InputFilter m_inputFilter;
|
InputFilter m_inputFilter;
|
||||||
bool m_hasLockToScreenAction;
|
bool m_hasLockToScreenAction;
|
||||||
IEventQueue *m_events;
|
IEventQueue *m_events;
|
||||||
std::string m_ClientAddress;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Configuration read context
|
//! Configuration read context
|
||||||
|
|
|
||||||
|
|
@ -1334,7 +1334,6 @@ void Server::handleClientDisconnected(const Event &, void *vclient)
|
||||||
removeOldClient(client);
|
removeOldClient(client);
|
||||||
|
|
||||||
delete client;
|
delete client;
|
||||||
m_clientListener->restart();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::handleClientCloseTimeout(const Event &, void *vclient)
|
void Server::handleClientCloseTimeout(const Event &, void *vclient)
|
||||||
|
|
@ -2251,11 +2250,6 @@ bool Server::isReceivedFileSizeValid()
|
||||||
return m_expectedFileSize == m_receivedFileData.size();
|
return m_expectedFileSize == m_receivedFileData.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Server::isClientMode() const
|
|
||||||
{
|
|
||||||
return m_args.m_config->isClientMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Server::sendFileToClient(const char *filename)
|
void Server::sendFileToClient(const char *filename)
|
||||||
{
|
{
|
||||||
if (m_sendFileThread != NULL) {
|
if (m_sendFileThread != NULL) {
|
||||||
|
|
|
||||||
|
|
@ -222,9 +222,6 @@ public:
|
||||||
return m_fakeDragFileList;
|
return m_fakeDragFileList;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns true if it's client mode and server initiates connection
|
|
||||||
bool isClientMode() const;
|
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue