refactor: remove unused --host arg from deskflow-client

This commit is contained in:
sithlord48 2025-04-04 13:41:44 -04:00 committed by Chris Rizzitello
parent d4f916c365
commit 0a33e20723
4 changed files with 15 additions and 33 deletions

View file

@ -134,24 +134,20 @@ void Client::connect(size_t addressIndex)
auto securityLevel = m_useSecureNetwork ? SecurityLevel::PeerAuth : SecurityLevel::PlainText; auto securityLevel = m_useSecureNetwork ? SecurityLevel::PeerAuth : SecurityLevel::PlainText;
try { try {
if (m_args.m_hostMode) { // resolve the server hostname. do this every time we connect
LOG((CLOG_NOTE "waiting for server connection on %i port", m_serverAddress.getPort())); // in case we couldn't resolve the address earlier or the address
} else { // has changed (which can happen frequently if this is a laptop
// resolve the server hostname. do this every time we connect // being shuttled between various networks). patch by Brent
// in case we couldn't resolve the address earlier or the address // Priddy.
// has changed (which can happen frequently if this is a laptop m_resolvedAddressesCount = m_serverAddress.resolve(addressIndex);
// being shuttled between various networks). patch by Brent
// Priddy.
m_resolvedAddressesCount = m_serverAddress.resolve(addressIndex);
// m_serverAddress will be null if the hostname address is not reolved // m_serverAddress will be null if the hostname address is not reolved
if (m_serverAddress.getAddress() != nullptr) { if (m_serverAddress.getAddress() != nullptr) {
// to help users troubleshoot, show server host name (issue: 60) // to help users troubleshoot, show server host name (issue: 60)
LOG( LOG(
(CLOG_NOTE "connecting to '%s': %s:%i", m_serverAddress.getHostname().c_str(), (CLOG_NOTE "connecting to '%s': %s:%i", m_serverAddress.getHostname().c_str(),
ARCH->addrToString(m_serverAddress.getAddress()).c_str(), m_serverAddress.getPort()) ARCH->addrToString(m_serverAddress.getAddress()).c_str(), m_serverAddress.getPort())
); );
}
} }
// create the socket // create the socket
@ -509,11 +505,8 @@ void Client::setupScreen()
void Client::setupTimer() void Client::setupTimer()
{ {
assert(m_timer == NULL); assert(m_timer == NULL);
m_timer = m_events->newOneShotTimer(2.0, NULL);
if (!m_args.m_hostMode) { m_events->adoptHandler(Event::kTimer, m_timer, new TMethodEventJob<Client>(this, &Client::handleConnectTimeout));
m_timer = m_events->newOneShotTimer(2.0, NULL);
m_events->adoptHandler(Event::kTimer, m_timer, new TMethodEventJob<Client>(this, &Client::handleConnectTimeout));
}
} }
void Client::cleanup() void Client::cleanup()

View file

@ -88,8 +88,6 @@ bool ArgParser::parseClientArgs(deskflow::ClientArgs &args, int argc, const char
args.m_enableLangSync = true; args.m_enableLangSync = true;
} else if (isArg(i, argc, argv, nullptr, "--invert-scroll")) { } else if (isArg(i, argc, argv, nullptr, "--invert-scroll")) {
args.m_clientScrollDirection = deskflow::ClientScrollDirection::INVERT_SERVER; args.m_clientScrollDirection = deskflow::ClientScrollDirection::INVERT_SERVER;
} else if (isArg(i, argc, argv, nullptr, "--host")) {
args.m_hostMode = true;
} else if (isArg(i, argc, argv, nullptr, "client")) { } else if (isArg(i, argc, argv, nullptr, "client")) {
++i; ++i;
continue; continue;

View file

@ -113,7 +113,6 @@ void ClientApp::help()
<< " [--yscroll <delta>]" << " [--yscroll <delta>]"
<< " [--sync-language]" << " [--sync-language]"
<< " [--invert-scroll]" << " [--invert-scroll]"
<< " [--host]"
#ifdef WINAPI_XWINDOWS #ifdef WINAPI_XWINDOWS
<< " [--display <display>]" << " [--display <display>]"
<< " [--no-xinitthreads]" << " [--no-xinitthreads]"
@ -131,8 +130,6 @@ void ClientApp::help()
<< " --sync-language enable language synchronization.\n" << " --sync-language enable language synchronization.\n"
<< " --invert-scroll invert scroll direction on this\n" << " --invert-scroll invert scroll direction on this\n"
<< " computer.\n" << " computer.\n"
<< " --host act as a host; invert server/client mode\n"
<< " and listen instead of connecting.\n"
#if WINAPI_XWINDOWS #if WINAPI_XWINDOWS
<< " --display <display> when in X mode, connect to the X server\n" << " --display <display> when in X mode, connect to the X server\n"
<< " at <display>.\n" << " at <display>.\n"

View file

@ -34,12 +34,6 @@ public:
*/ */
ClientScrollDirection m_clientScrollDirection = ClientScrollDirection::SERVER; ClientScrollDirection m_clientScrollDirection = ClientScrollDirection::SERVER;
/**
* @brief m_hostMode - activates host mode.
* Client starts a listener and waits for a server connection.
*/
bool m_hostMode = false;
/** /**
* @brief m_serverAddress stores deskflow server address * @brief m_serverAddress stores deskflow server address
*/ */