From cbdc79975e737e84afdea8f318e2fec0f291ed33 Mon Sep 17 00:00:00 2001 From: faithwang Date: Wed, 6 Jul 2022 11:42:16 +0800 Subject: [PATCH] delete shankhand message version Signed-off-by: faithwang --- src/host/client.cpp | 7 +++++-- src/host/server_for_client.cpp | 7 ++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/host/client.cpp b/src/host/client.cpp index 711f46d5..c2d49ef9 100755 --- a/src/host/client.cpp +++ b/src/host/client.cpp @@ -378,6 +378,7 @@ int HdcClient::PreHandshake(HChannel hChannel, const uint8_t *buf) return ERR_BUF_COPY; } +#ifdef HDC_VERSION_CHECK // add check version if (!isCheckVersionCmd) { // do not check version cause user want to get server version string clientVer = Base::GetVersion() + HDC_MSG_HASH; @@ -386,13 +387,15 @@ int HdcClient::PreHandshake(HChannel hChannel, const uint8_t *buf) if (clientVer != serverVer) { serverVer = serverVer.substr(0, Base::GetVersion().size()); WRITE_LOG(LOG_FATAL, "Client version:%s, server version:%s", clientVer.c_str(), serverVer.c_str()); -#ifdef HDC_VERSION_CHECK hChannel->availTailIndex = 0; return ERR_CHECK_VERSION; -#endif } } Send(hChannel->channelId, reinterpret_cast(hShake), sizeof(ChannelHandShake)); +#else + // do not send version message if check feature disable + Send(hChannel->channelId, reinterpret_cast(hShake), offsetof(struct ChannelHandShake, version)); +#endif hChannel->handshakeOK = true; #ifdef HDC_CHANNEL_KEEP_ALIVE // Evaluation method, non long-term support diff --git a/src/host/server_for_client.cpp b/src/host/server_for_client.cpp index 75504035..c2fce001 100755 --- a/src/host/server_for_client.cpp +++ b/src/host/server_for_client.cpp @@ -74,7 +74,12 @@ void HdcServerForClient::AcceptClient(uv_stream_t *server, int status) WRITE_LOG(LOG_FATAL, "strcpy_s failed"); return; } - thisClass->Send(hChannel->channelId, (uint8_t *)&handShake, sizeof(struct ChannelHandShake)); +#ifdef HDC_VERSION_CHECK + thisClass->Send(hChannel->channelId, (uint8_t *)&handShake, sizeof(struct ChannelHandShake)); +#else + // do not send version message if check feature disable + thisClass->Send(hChannel->channelId, (uint8_t *)&handShake, offsetof(struct ChannelHandShake, version)); +#endif } } -- Gitee