提交 a630d128 编写于 作者: dengyihao's avatar dengyihao

add version check in rpc

上级 d0d8d93c
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "sut.h" #include "sut.h"
#include "tdatablock.h" #include "tdatablock.h"
#include "tmisce.h" #include "tmisce.h"
#include "tversion.h"
static void processClientRsp(void* parent, SRpcMsg* pRsp, SEpSet* pEpSet) { static void processClientRsp(void* parent, SRpcMsg* pRsp, SEpSet* pEpSet) {
TestClient* client = (TestClient*)parent; TestClient* client = (TestClient*)parent;
...@@ -53,6 +54,7 @@ void TestClient::DoInit() { ...@@ -53,6 +54,7 @@ void TestClient::DoInit() {
rpcInit.parent = this; rpcInit.parent = this;
// rpcInit.secret = (char*)secretEncrypt; // rpcInit.secret = (char*)secretEncrypt;
// rpcInit.spi = 1; // rpcInit.spi = 1;
taosVersionStrToInt(version, &(rpcInit.compatibilityVer));
clientRpc = rpcOpen(&rpcInit); clientRpc = rpcOpen(&rpcInit);
ASSERT(clientRpc); ASSERT(clientRpc);
......
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
#include "tdatablock.h" #include "tdatablock.h"
#include "tglobal.h" #include "tglobal.h"
#include "tlog.h" #include "tlog.h"
#include "tmisce.h"
#include "transLog.h" #include "transLog.h"
#include "trpc.h" #include "trpc.h"
#include "tmisce.h" #include "tversion.h"
using namespace std; using namespace std;
const char *label = "APP"; const char *label = "APP";
...@@ -54,6 +54,8 @@ class Client { ...@@ -54,6 +54,8 @@ class Client {
rpcInit_.user = (char *)user; rpcInit_.user = (char *)user;
rpcInit_.parent = this; rpcInit_.parent = this;
rpcInit_.connType = TAOS_CONN_CLIENT; rpcInit_.connType = TAOS_CONN_CLIENT;
taosVersionStrToInt(version, &(rpcInit_.compatibilityVer));
this->transCli = rpcOpen(&rpcInit_); this->transCli = rpcOpen(&rpcInit_);
tsem_init(&this->sem, 0, 0); tsem_init(&this->sem, 0, 0);
} }
...@@ -66,6 +68,7 @@ class Client { ...@@ -66,6 +68,7 @@ class Client {
void Restart(CB cb) { void Restart(CB cb) {
rpcClose(this->transCli); rpcClose(this->transCli);
rpcInit_.cfp = cb; rpcInit_.cfp = cb;
taosVersionStrToInt(version, &(rpcInit_.compatibilityVer));
this->transCli = rpcOpen(&rpcInit_); this->transCli = rpcOpen(&rpcInit_);
} }
void Stop() { void Stop() {
...@@ -117,6 +120,7 @@ class Server { ...@@ -117,6 +120,7 @@ class Server {
rpcInit_.cfp = processReq; rpcInit_.cfp = processReq;
rpcInit_.user = (char *)user; rpcInit_.user = (char *)user;
rpcInit_.connType = TAOS_CONN_SERVER; rpcInit_.connType = TAOS_CONN_SERVER;
taosVersionStrToInt(version, &(rpcInit_.compatibilityVer));
} }
void Start() { void Start() {
this->transSrv = rpcOpen(&this->rpcInit_); this->transSrv = rpcOpen(&this->rpcInit_);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册