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

taosdata / TDengine / #4881

14 Dec 2025 03:48AM UTC coverage: 60.617% (+0.5%) from 60.092%
#4881

push

travis-ci

web-flow
test: update coverage workflow time (#33918)

156854 of 258761 relevant lines covered (60.62%)

75258957.81 hits per line

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

59.26
/source/dnode/bnode/src/bnode.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
#include "libs/tmqtt/tmqtt.h"
17
#include "bndInt.h"
18

19
int32_t bndOpen(const SBnodeOpt *pOption, SBnode **pBnode) {
19,591✔
20
  int32_t code = 0;
19,591✔
21

22
  *pBnode = taosMemoryCalloc(1, sizeof(SBnode));
19,591✔
23
  if (NULL == *pBnode) {
19,591✔
24
    bndError("calloc SBnode failed");
×
25
    code = terrno;
×
26
    TAOS_RETURN(code);
×
27
  }
28

29
  (*pBnode)->msgCb = pOption->msgCb;
19,591✔
30
  (*pBnode)->dnodeId = pOption->dnodeId;
19,591✔
31
  (*pBnode)->protocol = (int8_t)pOption->proto;
19,591✔
32

33
  if (TSDB_BNODE_OPT_PROTO_MQTT == (*pBnode)->protocol) {
19,591✔
34
    if ((code = mqttMgmtStartMqttd((*pBnode)->dnodeId)) != 0) {
19,591✔
35
      bndError("failed to start taosudf since %s", tstrerror(code));
×
36
      taosMemoryFree(*pBnode);
×
37
      *pBnode = NULL;
×
38
      TAOS_RETURN(code);
×
39
    }
40
  } else {
41
    bndError("Unknown bnode proto: %hhd.", (*pBnode)->protocol);
×
42
    taosMemoryFree(*pBnode);
×
43
    *pBnode = NULL;
×
44
    TAOS_RETURN(code);
×
45
  }
46

47
  bndInfo("Bnode opened.");
19,591✔
48

49
  return TSDB_CODE_SUCCESS;
19,591✔
50
}
51

52
void bndClose(SBnode *pBnode) {
19,591✔
53
  mqttMgmtStopMqttd();
19,591✔
54

55
  taosMemoryFree(pBnode);
19,591✔
56

57
  bndInfo("Bnode closed.");
19,591✔
58
}
19,591✔
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