transUT.cpp 11.9 KB
Newer Older
dengyihao's avatar
dengyihao 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3 * or later ("AGPL"), as published by the Free
 * Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
#include <gtest/gtest.h>
#include <cstdio>
#include <cstring>
dengyihao's avatar
dengyihao 已提交
18
#include "rpcLog.h"
H
Haojun Liao 已提交
19
#include "tdatablock.h"
dengyihao's avatar
dengyihao 已提交
20
#include "tglobal.h"
S
log  
Shengliang Guan 已提交
21
#include "tlog.h"
H
Haojun Liao 已提交
22
#include "trpc.h"
dengyihao's avatar
dengyihao 已提交
23 24
using namespace std;

dengyihao's avatar
dengyihao 已提交
25 26 27 28
const char *label = "APP";
const char *secret = "secret";
const char *user = "user";
const char *ckey = "ckey";
dengyihao's avatar
dengyihao 已提交
29

dengyihao's avatar
dengyihao 已提交
30 31 32
class Server;
int port = 7000;
// server process
dengyihao's avatar
dengyihao 已提交
33
// server except
dengyihao's avatar
dengyihao 已提交
34

dengyihao's avatar
dengyihao 已提交
35
typedef void (*CB)(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet);
dengyihao's avatar
dengyihao 已提交
36 37

static void processContinueSend(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet);
dengyihao's avatar
dengyihao 已提交
38 39
static void processReleaseHandleCb(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet);
static void processRegisterFailure(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet);
dengyihao's avatar
dengyihao 已提交
40 41 42 43 44 45
static void processReq(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet);
// client process;
static void processResp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet);
class Client {
 public:
  void Init(int nThread) {
dengyihao's avatar
dengyihao 已提交
46 47 48 49 50 51 52 53 54 55 56 57
    memset(&rpcInit_, 0, sizeof(rpcInit_));
    rpcInit_.localPort = 0;
    rpcInit_.label = (char *)label;
    rpcInit_.numOfThreads = nThread;
    rpcInit_.cfp = processResp;
    rpcInit_.user = (char *)user;
    rpcInit_.secret = (char *)secret;
    rpcInit_.ckey = (char *)ckey;
    rpcInit_.spi = 1;
    rpcInit_.parent = this;
    rpcInit_.connType = TAOS_CONN_CLIENT;
    this->transCli = rpcOpen(&rpcInit_);
dengyihao's avatar
dengyihao 已提交
58
    tsem_init(&this->sem, 0, 0);
dengyihao's avatar
dengyihao 已提交
59
  }
dengyihao's avatar
dengyihao 已提交
60 61 62 63 64 65
  void SetResp(SRpcMsg *pMsg) {
    // set up resp;
    this->resp = *pMsg;
  }
  SRpcMsg *Resp() { return &this->resp; }

dengyihao's avatar
dengyihao 已提交
66 67 68 69 70
  void Restart(CB cb) {
    rpcClose(this->transCli);
    rpcInit_.cfp = cb;
    this->transCli = rpcOpen(&rpcInit_);
  }
dengyihao's avatar
dengyihao 已提交
71 72 73 74
  void Stop() {
    rpcClose(this->transCli);
    this->transCli = NULL;
  }
dengyihao's avatar
dengyihao 已提交
75

dengyihao's avatar
dengyihao 已提交
76
  void SendAndRecv(SRpcMsg *req, SRpcMsg *resp) {
dengyihao's avatar
dengyihao 已提交
77 78
    SEpSet epSet = {0};
    epSet.inUse = 0;
dengyihao's avatar
dengyihao 已提交
79
    addEpIntoEpSet(&epSet, "127.0.0.1", 7000);
dengyihao's avatar
dengyihao 已提交
80

dengyihao's avatar
dengyihao 已提交
81 82 83
    rpcSendRequest(this->transCli, &epSet, req, NULL);
    SemWait();
    *resp = this->resp;
dengyihao's avatar
dengyihao 已提交
84
  }
dengyihao's avatar
dengyihao 已提交
85 86 87 88 89 90 91 92
  void SendAndRecvNoHandle(SRpcMsg *req, SRpcMsg *resp) {
    if (req->handle != NULL) {
      rpcReleaseHandle(req->handle, TAOS_CONN_CLIENT);
      req->handle = NULL;
    }
    SendAndRecv(req, resp);
  }

dengyihao's avatar
dengyihao 已提交
93 94 95 96 97 98
  void SemWait() { tsem_wait(&this->sem); }
  void SemPost() { tsem_post(&this->sem); }
  void Reset() {}

  ~Client() {
    if (this->transCli) rpcClose(this->transCli);
dengyihao's avatar
dengyihao 已提交
99 100 101
  }

 private:
dengyihao's avatar
dengyihao 已提交
102
  tsem_t   sem;
dengyihao's avatar
dengyihao 已提交
103
  SRpcInit rpcInit_;
dengyihao's avatar
dengyihao 已提交
104 105 106 107 108 109
  void *   transCli;
  SRpcMsg  resp;
};
class Server {
 public:
  Server() {
dengyihao's avatar
dengyihao 已提交
110 111 112 113 114 115 116 117 118 119
    memset(&rpcInit_, 0, sizeof(rpcInit_));
    rpcInit_.localPort = port;
    rpcInit_.label = (char *)label;
    rpcInit_.numOfThreads = 5;
    rpcInit_.cfp = processReq;
    rpcInit_.user = (char *)user;
    rpcInit_.secret = (char *)secret;
    rpcInit_.ckey = (char *)ckey;
    rpcInit_.spi = 1;
    rpcInit_.connType = TAOS_CONN_SERVER;
dengyihao's avatar
dengyihao 已提交
120 121
  }
  void Start() {
dengyihao's avatar
dengyihao 已提交
122
    this->transSrv = rpcOpen(&this->rpcInit_);
dengyihao's avatar
dengyihao 已提交
123 124
    taosMsleep(1000);
  }
dengyihao's avatar
dengyihao 已提交
125 126 127 128 129
  void SetSrvContinueSend(CB cb) {
    this->Stop();
    rpcInit_.cfp = cb;
    this->Start();
  }
dengyihao's avatar
dengyihao 已提交
130 131 132 133 134
  void Stop() {
    if (this->transSrv == NULL) return;
    rpcClose(this->transSrv);
    this->transSrv = NULL;
  }
dengyihao's avatar
dengyihao 已提交
135
  void SetSrvSend(void (*cfp)(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet)) {
dengyihao's avatar
dengyihao 已提交
136 137 138 139
    this->Stop();
    rpcInit_.cfp = cfp;
    this->Start();
  }
dengyihao's avatar
dengyihao 已提交
140 141 142 143 144 145 146 147 148 149
  void Restart() {
    this->Stop();
    this->Start();
  }
  ~Server() {
    if (this->transSrv) rpcClose(this->transSrv);
    this->transSrv = NULL;
  }

 private:
dengyihao's avatar
dengyihao 已提交
150
  SRpcInit rpcInit_;
dengyihao's avatar
dengyihao 已提交
151 152 153 154 155 156 157 158 159 160
  void *   transSrv;
};
static void processReq(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
  SRpcMsg rpcMsg = {0};
  rpcMsg.pCont = rpcMallocCont(100);
  rpcMsg.contLen = 100;
  rpcMsg.handle = pMsg->handle;
  rpcMsg.code = 0;
  rpcSendResponse(&rpcMsg);
}
dengyihao's avatar
dengyihao 已提交
161 162 163 164 165 166 167 168 169 170 171

static void processContinueSend(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
  for (int i = 0; i < 10; i++) {
    SRpcMsg rpcMsg = {0};
    rpcMsg.pCont = rpcMallocCont(100);
    rpcMsg.contLen = 100;
    rpcMsg.handle = pMsg->handle;
    rpcMsg.code = 0;
    rpcSendResponse(&rpcMsg);
  }
}
dengyihao's avatar
dengyihao 已提交
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
static void processReleaseHandleCb(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
  SRpcMsg rpcMsg = {0};
  rpcMsg.pCont = rpcMallocCont(100);
  rpcMsg.contLen = 100;
  rpcMsg.handle = pMsg->handle;
  rpcMsg.code = 0;
  rpcSendResponse(&rpcMsg);

  rpcReleaseHandle(pMsg->handle, TAOS_CONN_SERVER);
}
static void processRegisterFailure(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
  void *handle = pMsg->handle;
  {
    SRpcMsg rpcMsg1 = {0};
    rpcMsg1.pCont = rpcMallocCont(100);
    rpcMsg1.contLen = 100;
    rpcMsg1.handle = handle;
    rpcMsg1.code = 0;
    rpcRegisterBrokenLinkArg(&rpcMsg1);
  }
  taosMsleep(10);

  SRpcMsg rpcMsg = {0};
  rpcMsg.pCont = rpcMallocCont(100);
  rpcMsg.contLen = 100;
  rpcMsg.handle = pMsg->handle;
  rpcMsg.code = 0;
  rpcSendResponse(&rpcMsg);
}
dengyihao's avatar
dengyihao 已提交
201 202 203 204 205
// client process;
static void processResp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
  Client *client = (Client *)parent;
  client->SetResp(pMsg);
  client->SemPost();
dengyihao's avatar
dengyihao 已提交
206
  tDebug("received resp");
dengyihao's avatar
dengyihao 已提交
207
}
dengyihao's avatar
dengyihao 已提交
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225

static void initEnv() {
  dDebugFlag = 143;
  vDebugFlag = 0;
  mDebugFlag = 143;
  cDebugFlag = 0;
  jniDebugFlag = 0;
  tmrDebugFlag = 143;
  uDebugFlag = 143;
  rpcDebugFlag = 143;
  qDebugFlag = 0;
  wDebugFlag = 0;
  sDebugFlag = 0;
  tsdbDebugFlag = 0;
  tsLogEmbedded = 1;
  tsAsyncLog = 0;

  std::string path = "/tmp/transport";
dengyihao's avatar
dengyihao 已提交
226
  // taosRemoveDir(path.c_str());
dengyihao's avatar
dengyihao 已提交
227 228 229 230 231 232 233
  taosMkDir(path.c_str());

  tstrncpy(tsLogDir, path.c_str(), PATH_MAX);
  if (taosInitLog("taosdlog", 1) != 0) {
    printf("failed to init log file\n");
  }
}
dengyihao's avatar
dengyihao 已提交
234

dengyihao's avatar
dengyihao 已提交
235 236 237
class TransObj {
 public:
  TransObj() {
dengyihao's avatar
dengyihao 已提交
238
    initEnv();
dengyihao's avatar
dengyihao 已提交
239 240 241 242 243
    cli = new Client;
    cli->Init(1);
    srv = new Server;
    srv->Start();
  }
dengyihao's avatar
dengyihao 已提交
244

dengyihao's avatar
dengyihao 已提交
245 246 247 248 249 250 251 252 253 254 255 256
  void RestartCli(CB cb) {
    //
    cli->Restart(cb);
  }
  void StopSrv() {
    //
    srv->Stop();
  }
  // call when link broken, and notify query or fetch stop
  void SetSrvContinueSend(void (*cfp)(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet)) {
    ///////
    srv->SetSrvContinueSend(cfp);
dengyihao's avatar
dengyihao 已提交
257
  }
dengyihao's avatar
dengyihao 已提交
258
  void RestartSrv() { srv->Restart(); }
dengyihao's avatar
dengyihao 已提交
259
  void StopCli() {
dengyihao's avatar
dengyihao 已提交
260 261 262
    ///////
    cli->Stop();
  }
dengyihao's avatar
dengyihao 已提交
263
  void cliSendAndRecv(SRpcMsg *req, SRpcMsg *resp) { cli->SendAndRecv(req, resp); }
dengyihao's avatar
dengyihao 已提交
264
  void cliSendAndRecvNoHandle(SRpcMsg *req, SRpcMsg *resp) { cli->SendAndRecvNoHandle(req, resp); }
dengyihao's avatar
dengyihao 已提交
265

dengyihao's avatar
dengyihao 已提交
266 267 268 269 270 271 272 273
  ~TransObj() {
    delete cli;
    delete srv;
  }

 private:
  Client *cli;
  Server *srv;
dengyihao's avatar
dengyihao 已提交
274 275 276 277 278 279 280 281 282 283 284 285 286 287
};
class TransEnv : public ::testing::Test {
 protected:
  virtual void SetUp() {
    // set up trans obj
    tr = new TransObj();
  }
  virtual void TearDown() {
    // tear down
    delete tr;
  }

  TransObj *tr = NULL;
};
dengyihao's avatar
dengyihao 已提交
288

dengyihao's avatar
dengyihao 已提交
289
TEST_F(TransEnv, 01sendAndRec) {
dengyihao's avatar
dengyihao 已提交
290
  for (int i = 0; i < 10; i++) {
dengyihao's avatar
dengyihao 已提交
291 292 293 294 295 296 297 298
    SRpcMsg req = {0}, resp = {0};
    req.msgType = 0;
    req.pCont = rpcMallocCont(10);
    req.contLen = 10;
    tr->cliSendAndRecv(&req, &resp);
    assert(resp.code == 0);
  }
}
dengyihao's avatar
dengyihao 已提交
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316

TEST_F(TransEnv, 02StopServer) {
  for (int i = 0; i < 1; i++) {
    SRpcMsg req = {0}, resp = {0};
    req.msgType = 0;
    req.pCont = rpcMallocCont(10);
    req.contLen = 10;
    tr->cliSendAndRecv(&req, &resp);
    assert(resp.code == 0);
  }
  SRpcMsg req = {0}, resp = {0};
  req.msgType = 1;
  req.pCont = rpcMallocCont(10);
  req.contLen = 10;
  tr->StopSrv();
  // tr->RestartSrv();
  tr->cliSendAndRecv(&req, &resp);
  assert(resp.code != 0);
dengyihao's avatar
dengyihao 已提交
317
}
dengyihao's avatar
dengyihao 已提交
318 319 320 321 322 323 324 325 326 327 328 329 330
TEST_F(TransEnv, clientUserDefined) {
  tr->RestartSrv();
  for (int i = 0; i < 10; i++) {
    SRpcMsg req = {0}, resp = {0};
    req.msgType = 0;
    req.pCont = rpcMallocCont(10);
    req.contLen = 10;
    tr->cliSendAndRecv(&req, &resp);
    assert(resp.code == 0);
  }

  //////////////////
}
dengyihao's avatar
dengyihao 已提交
331 332

TEST_F(TransEnv, cliPersistHandle) {
dengyihao's avatar
dengyihao 已提交
333
  SRpcMsg resp = {0};
dengyihao's avatar
dengyihao 已提交
334
  void *  handle = NULL;
dengyihao's avatar
dengyihao 已提交
335
  for (int i = 0; i < 10; i++) {
H
Haojun Liao 已提交
336 337 338 339
    SRpcMsg req = {0};
    req.handle = resp.handle;
    req.persistHandle = 1;

dengyihao's avatar
dengyihao 已提交
340 341 342 343
    req.msgType = 1;
    req.pCont = rpcMallocCont(10);
    req.contLen = 10;
    tr->cliSendAndRecv(&req, &resp);
dengyihao's avatar
dengyihao 已提交
344 345 346 347 348 349 350 351
    // if (i == 5) {
    //  std::cout << "stop server" << std::endl;
    //  tr->StopSrv();
    //}
    // if (i >= 6) {
    //  EXPECT_TRUE(resp.code != 0);
    //}
    handle = resp.handle;
dengyihao's avatar
dengyihao 已提交
352
  }
dengyihao's avatar
dengyihao 已提交
353 354 355 356 357 358 359 360 361 362
  rpcReleaseHandle(handle, TAOS_CONN_CLIENT);
  for (int i = 0; i < 10; i++) {
    SRpcMsg req = {0};
    req.msgType = 1;
    req.pCont = rpcMallocCont(10);
    req.contLen = 10;
    tr->cliSendAndRecv(&req, &resp);
  }

  taosMsleep(1000);
dengyihao's avatar
dengyihao 已提交
363 364 365
  //////////////////
}

dengyihao's avatar
dengyihao 已提交
366
TEST_F(TransEnv, srvReleaseHandle) {
dengyihao's avatar
dengyihao 已提交
367
  SRpcMsg resp = {0};
dengyihao's avatar
dengyihao 已提交
368 369
  tr->SetSrvContinueSend(processReleaseHandleCb);
  // tr->Restart(processReleaseHandleCb);
dengyihao's avatar
dengyihao 已提交
370 371
  void *  handle = NULL;
  SRpcMsg req = {0};
dengyihao's avatar
dengyihao 已提交
372
  for (int i = 0; i < 1; i++) {
dengyihao's avatar
dengyihao 已提交
373 374 375
    memset(&req, 0, sizeof(req));
    req.handle = resp.handle;
    req.persistHandle = 1;
dengyihao's avatar
dengyihao 已提交
376 377 378
    req.msgType = 1;
    req.pCont = rpcMallocCont(10);
    req.contLen = 10;
dengyihao's avatar
dengyihao 已提交
379 380
    tr->cliSendAndRecv(&req, &resp);
    // tr->cliSendAndRecvNoHandle(&req, &resp);
dengyihao's avatar
dengyihao 已提交
381 382 383 384 385 386
    EXPECT_TRUE(resp.code == 0);
  }
  //////////////////
}
TEST_F(TransEnv, cliReleaseHandleExcept) {
  SRpcMsg resp = {0};
dengyihao's avatar
dengyihao 已提交
387
  SRpcMsg req = {0};
dengyihao's avatar
dengyihao 已提交
388
  for (int i = 0; i < 3; i++) {
dengyihao's avatar
dengyihao 已提交
389 390 391
    memset(&req, 0, sizeof(req));
    req.handle = resp.handle;
    req.persistHandle = 1;
dengyihao's avatar
dengyihao 已提交
392 393 394
    req.msgType = 1;
    req.pCont = rpcMallocCont(10);
    req.contLen = 10;
dengyihao's avatar
dengyihao 已提交
395 396
    tr->cliSendAndRecv(&req, &resp);
    if (i == 1) {
dengyihao's avatar
dengyihao 已提交
397 398 399
      std::cout << "stop server" << std::endl;
      tr->StopSrv();
    }
dengyihao's avatar
dengyihao 已提交
400
    if (i > 1) {
dengyihao's avatar
dengyihao 已提交
401 402 403
      EXPECT_TRUE(resp.code != 0);
    }
  }
dengyihao's avatar
dengyihao 已提交
404
  //////////////////
dengyihao's avatar
dengyihao 已提交
405
}
dengyihao's avatar
dengyihao 已提交
406 407
TEST_F(TransEnv, srvContinueSend) {
  tr->SetSrvContinueSend(processContinueSend);
dengyihao's avatar
dengyihao 已提交
408
  SRpcMsg req = {0}, resp = {0};
dengyihao's avatar
dengyihao 已提交
409
  for (int i = 0; i < 10; i++) {
dengyihao's avatar
dengyihao 已提交
410 411
    memset(&req, 0, sizeof(req));
    memset(&resp, 0, sizeof(resp));
dengyihao's avatar
dengyihao 已提交
412 413 414 415 416
    req.msgType = 1;
    req.pCont = rpcMallocCont(10);
    req.contLen = 10;
    tr->cliSendAndRecv(&req, &resp);
  }
dengyihao's avatar
dengyihao 已提交
417
  taosMsleep(1000);
dengyihao's avatar
dengyihao 已提交
418 419
}

dengyihao's avatar
dengyihao 已提交
420
TEST_F(TransEnv, srvPersistHandleExcept) {
dengyihao's avatar
dengyihao 已提交
421
  tr->SetSrvContinueSend(processContinueSend);
dengyihao's avatar
dengyihao 已提交
422
  // tr->SetCliPersistFp(cliPersistHandle);
dengyihao's avatar
dengyihao 已提交
423
  SRpcMsg resp = {0};
dengyihao's avatar
dengyihao 已提交
424
  SRpcMsg req = {0};
dengyihao's avatar
dengyihao 已提交
425
  for (int i = 0; i < 5; i++) {
dengyihao's avatar
dengyihao 已提交
426 427
    memset(&req, 0, sizeof(req));
    req.handle = resp.handle;
dengyihao's avatar
dengyihao 已提交
428 429 430 431 432
    req.msgType = 1;
    req.pCont = rpcMallocCont(10);
    req.contLen = 10;
    tr->cliSendAndRecv(&req, &resp);
    if (i > 2) {
dengyihao's avatar
dengyihao 已提交
433
      tr->StopCli();
dengyihao's avatar
dengyihao 已提交
434 435 436 437 438
      break;
    }
  }
  taosMsleep(2000);
  // conn broken
dengyihao's avatar
dengyihao 已提交
439 440
  //
}
dengyihao's avatar
dengyihao 已提交
441 442 443
TEST_F(TransEnv, cliPersistHandleExcept) {
  tr->SetSrvContinueSend(processContinueSend);
  SRpcMsg resp = {0};
dengyihao's avatar
dengyihao 已提交
444
  SRpcMsg req = {0};
dengyihao's avatar
dengyihao 已提交
445
  for (int i = 0; i < 5; i++) {
dengyihao's avatar
dengyihao 已提交
446 447
    memset(&req, 0, sizeof(req));
    req.handle = resp.handle;
dengyihao's avatar
dengyihao 已提交
448 449 450 451 452 453 454 455 456 457 458 459 460
    req.msgType = 1;
    req.pCont = rpcMallocCont(10);
    req.contLen = 10;
    tr->cliSendAndRecv(&req, &resp);
    if (i > 2) {
      tr->StopSrv();
      break;
    }
  }
  taosMsleep(2000);
  // conn broken
  //
}
dengyihao's avatar
dengyihao 已提交
461

dengyihao's avatar
dengyihao 已提交
462 463
TEST_F(TransEnv, multiCliPersistHandleExcept) {
  // conn broken
dengyihao's avatar
dengyihao 已提交
464
}
dengyihao's avatar
dengyihao 已提交
465 466 467
TEST_F(TransEnv, queryExcept) {
  tr->SetSrvContinueSend(processRegisterFailure);
  SRpcMsg resp = {0};
dengyihao's avatar
dengyihao 已提交
468
  SRpcMsg req = {0};
dengyihao's avatar
dengyihao 已提交
469
  for (int i = 0; i < 5; i++) {
dengyihao's avatar
dengyihao 已提交
470 471 472
    memset(&req, 0, sizeof(req));
    req.handle = resp.handle;
    req.persistHandle = 1;
dengyihao's avatar
dengyihao 已提交
473 474 475 476 477 478 479 480 481 482 483 484
    req.msgType = 1;
    req.pCont = rpcMallocCont(10);
    req.contLen = 10;
    tr->cliSendAndRecv(&req, &resp);
    if (i == 2) {
      rpcReleaseHandle(resp.handle, TAOS_CONN_CLIENT);
      tr->StopCli();
      break;
    }
  }
  taosMsleep(4 * 1000);
}
dengyihao's avatar
dengyihao 已提交
485
TEST_F(TransEnv, noResp) {
dengyihao's avatar
dengyihao 已提交
486
  SRpcMsg resp = {0};
dengyihao's avatar
dengyihao 已提交
487
  SRpcMsg req = {0};
dengyihao's avatar
dengyihao 已提交
488
  for (int i = 0; i < 5; i++) {
dengyihao's avatar
dengyihao 已提交
489 490
    memset(&req, 0, sizeof(req));
    req.noResp = 1;
dengyihao's avatar
dengyihao 已提交
491 492 493 494 495 496 497
    req.msgType = 1;
    req.pCont = rpcMallocCont(10);
    req.contLen = 10;
    tr->cliSendAndRecv(&req, &resp);
  }
  taosMsleep(2000);

dengyihao's avatar
dengyihao 已提交
498 499
  // no resp
}