• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

taosdata / TDengine / #3768

28 Mar 2025 10:15AM UTC coverage: 33.726% (-0.3%) from 33.993%
#3768

push

travis-ci

happyguoxy
test:alter lcov result

144891 of 592084 branches covered (24.47%)

Branch coverage included in aggregate %.

218795 of 486283 relevant lines covered (44.99%)

765715.29 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.21
/source/libs/transport/src/tmsgcb.c
1
/*
2
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
3
 *
4
 * This program is free software: you can use, redistribute, and/or modify
5
 * it under the terms of the GNU Affero General Public License, version 3
6
 * or later ("AGPL"), as published by the Free Software Foundation.
7
 *
8
 * This program is distributed in the hope that it will be useful, but WITHOUT
9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
 * FITNESS FOR A PARTICULAR PURPOSE.
11
 *
12
 * You should have received a copy of the GNU Affero General Public License
13
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14
 */
15

16
#define _DEFAULT_SOURCE
17
#include "tmsgcb.h"
18
#include "taoserror.h"
19
#include "transLog.h"
20
#include "trpc.h"
21

22
static SMsgCb defaultMsgCb;
23

24
void tmsgSetDefault(const SMsgCb* msgcb) { defaultMsgCb = *msgcb; }
274✔
25

26
int32_t tmsgPutToQueue(const SMsgCb* msgcb, EQueueType qtype, SRpcMsg* pMsg) {
140,309✔
27
  int32_t code = (*msgcb->putToQueueFp)(msgcb->mgmt, qtype, pMsg);
140,309✔
28
  if (code != 0) {
140,310✔
29
    SRpcMsg rsp = {.code = code, .info = pMsg->info};
87✔
30
    if (rsp.info.handle != NULL) {
87!
31
      tmsgSendRsp(&rsp);
×
32
    }
33
    rpcFreeCont(pMsg->pCont);
87✔
34
    pMsg->pCont = NULL;
87✔
35
  }
36
  return code;
140,310✔
37
}
38

39
int32_t tmsgGetQueueSize(const SMsgCb* msgcb, int32_t vgId, EQueueType qtype) {
1,235✔
40
  return (*msgcb->qsizeFp)(msgcb->mgmt, vgId, qtype);  // vmGetQueueSize
1,235✔
41
}
42

43
int32_t tmsgSendReq(const SEpSet* epSet, SRpcMsg* pMsg) {
10,715✔
44
  int32_t code = (*defaultMsgCb.sendReqFp)(epSet, pMsg);
10,715✔
45
  if (code != 0) {
10,715!
46
    rpcFreeCont(pMsg->pCont);
×
47
    pMsg->pCont = NULL;
×
48
  }
49
  return code;
10,715✔
50
}
51

52
int32_t tmsgSendSyncReq(const SEpSet* epSet, SRpcMsg* pMsg) {
120,458✔
53
  int32_t code = (*defaultMsgCb.sendSyncReqFp)(epSet, pMsg);
120,458✔
54
  if (code != 0) {
120,463!
55
    rpcFreeCont(pMsg->pCont);
×
56
    pMsg->pCont = NULL;
×
57
  }
58
  return code;
120,463✔
59
}
60

61
void tmsgSendRsp(SRpcMsg* pMsg) {
88,290✔
62
#if 1
63
  if (rpcSendResponse(pMsg) != 0) {
88,290✔
64
    tError("failed to send response");
2!
65
  }
66
#else
67
  return (*defaultMsgCb.sendRspFp)(pMsg);
68
#endif
69
}
88,293✔
70

71
void tmsgRegisterBrokenLinkArg(SRpcMsg* pMsg) { (*defaultMsgCb.registerBrokenLinkArgFp)(pMsg); }
4,052✔
72

73
void tmsgReleaseHandle(SRpcHandleInfo* pHandle, int8_t type, int32_t status) {
3,914✔
74
  (*defaultMsgCb.releaseHandleFp)(pHandle, type, status);
3,914✔
75
}
3,914✔
76

77
void tmsgReportStartup(const char* name, const char* desc) { (*defaultMsgCb.reportStartupFp)(name, desc); }
3,556✔
78

79
bool tmsgUpdateDnodeInfo(int32_t* dnodeId, int64_t* clusterId, char* fqdn, uint16_t* port) {
37,639✔
80
  if (defaultMsgCb.updateDnodeInfoFp) {
37,639✔
81
    return (*defaultMsgCb.updateDnodeInfoFp)(defaultMsgCb.data, dnodeId, clusterId, fqdn, port);
37,622✔
82
  } else {
83
    return false;
17✔
84
  }
85
}
86

87
void tmsgUpdateDnodeEpSet(SEpSet* epset) {
27,189✔
88
  for (int32_t i = 0; i < epset->numOfEps; ++i) {
63,139✔
89
    bool ret = tmsgUpdateDnodeInfo(NULL, NULL, epset->eps[i].fqdn, &epset->eps[i].port);
35,950✔
90
  }
91
}
27,189✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc