refactor: use enum for connections security level

based on barrier: 5c7d719
This commit is contained in:
sithlord48
2024-11-28 07:28:55 -05:00
committed by Nick Bolton
parent 638349b48a
commit e996471e37
12 changed files with 73 additions and 27 deletions

View File

@ -1,5 +1,6 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2025 Deskflow Developers
* SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
* SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
@ -130,6 +131,8 @@ void Client::connect(size_t addressIndex)
return;
}
auto securityLevel = m_useSecureNetwork ? SecurityLevel::Encrypted : SecurityLevel::PlainText;
try {
if (m_args.m_hostMode) {
LOG((CLOG_NOTE "waiting for server connection on %i port", m_serverAddress.getPort()));
@ -152,8 +155,7 @@ void Client::connect(size_t addressIndex)
}
// create the socket
IDataSocket *socket =
m_socketFactory->create(m_useSecureNetwork, ARCH->getAddrFamily(m_serverAddress.getAddress()));
IDataSocket *socket = m_socketFactory->create(ARCH->getAddrFamily(m_serverAddress.getAddress()), securityLevel);
bindNetworkInterface(socket);
// filter socket messages, including a packetizing filter