refactor: remove kProtocolName vars and use the NetworkProtocol instead
fixes: #9401
This commit is contained in:
@ -11,6 +11,7 @@
|
||||
#include "arch/Arch.h"
|
||||
#include "base/IEventQueue.h"
|
||||
#include "base/Log.h"
|
||||
#include "base/NetworkProtocol.h"
|
||||
#include "client/ServerProxy.h"
|
||||
#include "common/Settings.h"
|
||||
#include "deskflow/Clipboard.h"
|
||||
@ -578,7 +579,8 @@ void Client::handleHello()
|
||||
std::string protocolName;
|
||||
ProtocolUtil::readf(m_stream, kMsgHello, &protocolName, &serverMajor, &serverMinor);
|
||||
|
||||
if (protocolName != kSynergyProtocolName && protocolName != kBarrierProtocolName) {
|
||||
if (const auto proto = networkProtocolFromString(QString::fromStdString(protocolName));
|
||||
proto == NetworkProtocol::Unknown) {
|
||||
LOG_WARN("hello back received with protocol: '%s'", protocolName.c_str());
|
||||
sendConnectionFailedEvent("got invalid hello message from server");
|
||||
cleanupTimer();
|
||||
|
||||
@ -7,11 +7,6 @@
|
||||
|
||||
#include "deskflow/ProtocolTypes.h"
|
||||
|
||||
// Protocol names used in network handshake messages (capitalized, must be exactly 7 chars).
|
||||
// Note that @ref kSynergyProtocolOption / @ref kBarrierProtocolOption use lowercase names.
|
||||
const char *const kSynergyProtocolName = "Synergy";
|
||||
const char *const kBarrierProtocolName = "Barrier";
|
||||
|
||||
// The protocol name string within the hello and hello back messages must be
|
||||
// 7 chars for backward compatibility (Synergy and Barrier are 7 chars).
|
||||
const char *const kMsgHello = "%7s%2i%2i";
|
||||
|
||||
@ -202,26 +202,6 @@ enum class TransferState : uint8_t
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Protocol name for Synergy compatibility
|
||||
*
|
||||
* Used in handshake messages to identify the protocol as Synergy-compatible.
|
||||
* Must be exactly 7 characters for backward compatibility.
|
||||
*
|
||||
* @since Protocol version 1.0
|
||||
*/
|
||||
extern const char *const kSynergyProtocolName;
|
||||
|
||||
/**
|
||||
* @brief Protocol name for Barrier compatibility
|
||||
*
|
||||
* Used in handshake messages to identify the protocol as Barrier-compatible.
|
||||
* Must be exactly 7 characters for backward compatibility.
|
||||
*
|
||||
* @since Protocol version 1.0
|
||||
*/
|
||||
extern const char *const kBarrierProtocolName;
|
||||
|
||||
/**
|
||||
* @brief Server hello message
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user