valid msg
This commit is contained in:
parent
f029995142
commit
0aa9db4fd5
|
@ -55,6 +55,7 @@ extern "C" {
|
|||
|
||||
extern char* tMsgInfo[];
|
||||
extern int32_t tMsgDict[];
|
||||
extern int32_t tMsgRangeDict[];
|
||||
|
||||
typedef uint16_t tmsg_t;
|
||||
|
||||
|
@ -62,8 +63,17 @@ typedef uint16_t tmsg_t;
|
|||
#define TMSG_SEG_SEQ(TYPE) ((TYPE)&0xff)
|
||||
#define TMSG_INDEX(TYPE) (tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE))
|
||||
|
||||
bool tmsgIsValid(tmsg_t type);
|
||||
char* TMSG_INFO(tmsg_t type);
|
||||
static inline bool tmsgIsValid(tmsg_t type) {
|
||||
// static int8_t sz = sizeof(tMsgRangeDict) / sizeof(tMsgRangeDict[0]);
|
||||
int8_t maxSegIdx = TMSG_SEG_CODE(TDMT_MAX_MSG);
|
||||
int segIdx = TMSG_SEG_CODE(type);
|
||||
if (segIdx >= 0 && segIdx < maxSegIdx) {
|
||||
return type < tMsgRangeDict[segIdx];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#define TMSG_INFO(type) (tmsgIsValid(type) ? tMsgInfo[TMSG_INDEX(type)] : "unKnown")
|
||||
|
||||
static inline bool vnodeIsMsgBlock(tmsg_t type) {
|
||||
return (type == TDMT_VND_CREATE_TABLE) || (type == TDMT_VND_ALTER_TABLE) || (type == TDMT_VND_DROP_TABLE) ||
|
||||
|
|
|
@ -364,6 +364,11 @@ TD_DEF_MSG_TYPE(TDMT_VND_ALTER_CONFIG, "alter-config", NULL, NULL)
|
|||
TD_DEF_MSG_TYPE(TDMT_VND_TMQ_MAX_MSG, "vnd-tmq-max", NULL, NULL)
|
||||
TD_CLOSE_MSG_TYPE(TDMT_END_TMQ_MSG)
|
||||
|
||||
TD_NEW_MSG_SEG(TDMT_MAX_MSG) // msg end mark
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(TD_MSG_NUMBER_)
|
||||
TDMT_MAX
|
||||
|
|
|
@ -39,17 +39,6 @@
|
|||
|
||||
#include "tlog.h"
|
||||
|
||||
inline bool tmsgIsValid(tmsg_t type) {
|
||||
static int8_t sz = sizeof(tMsgRangeDict) / sizeof(tMsgRangeDict[0]);
|
||||
|
||||
int segIdx = TMSG_SEG_CODE(type);
|
||||
if (segIdx >= 0 && segIdx < sz) {
|
||||
return type < tMsgRangeDict[segIdx];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline char *TMSG_INFO(tmsg_t type) { return (tmsgIsValid(type) ? tMsgInfo[TMSG_INDEX(type)] : "unKnown"); };
|
||||
#define DECODESQL() \
|
||||
do { \
|
||||
if (!tDecodeIsEnd(&decoder)) { \
|
||||
|
|
Loading…
Reference in New Issue