diff --git a/src/host/client.cpp b/src/host/client.cpp index 711f46d5f14563f27170da7fefc550e0cd2a92fa..c2d49ef966da00189623fdfd5dfa29e04dcfd4ea 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 75504035f421edb5c41b309a6ec08007d928a44a..c2fce00131c5466ddd7ec5031ca3796f8b949e11 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 } }