diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index c2bebaeee6cc21acab197e92b77358ddba42b0ff..ddc5b2de3730ef2e0e76bca9660643a5d9a977aa 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -963,9 +963,14 @@ static SRpcConn *rpcProcessMsgHead(SRpcInfo *pRpc, SRecvInfo *pRecv, SRpcReqCont terrno = TSDB_CODE_RPC_INVALID_SESSION_ID; return NULL; } - if (rpcIsReq(pHead->msgType) && htonl(pHead->msgVer) != tsVersion >> 8) { - tDebug("%s sid:%d, invalid client version:%x/%x %s", pRpc->label, sid, htonl(pHead->msgVer), tsVersion, taosMsg[pHead->msgType]); - terrno = TSDB_CODE_RPC_INVALID_VERSION; return NULL; + // compatibility between old version client and new version server, since 2.4.0.0 + if (rpcIsReq(pHead->msgType)){ + if((htonl(pHead->msgVer) >> 16 != tsVersion >> 24) || + ((htonl(pHead->msgVer) >> 16 == tsVersion >> 24) && htonl(pHead->msgVer) < ((2 << 16) | (4 << 8)))){ + tError("%s sid:%d, invalid client version:%x/%x %s", pRpc->label, sid, htonl(pHead->msgVer), tsVersion, taosMsg[pHead->msgType]); + terrno = TSDB_CODE_RPC_INVALID_VERSION; + return NULL; + } } pConn = rpcGetConnObj(pRpc, sid, pRecv); @@ -983,7 +988,8 @@ static SRpcConn *rpcProcessMsgHead(SRpcInfo *pRpc, SRecvInfo *pRecv, SRpcReqCont sid = pConn->sid; if (pConn->chandle == NULL) pConn->chandle = pRecv->chandle; - pConn->peerIp = pRecv->ip; + pConn->peerIp = pRecv->ip; + pConn->peerPort = pRecv->port; if (pHead->port) pConn->peerPort = htons(pHead->port);