fix debug info

This commit is contained in:
yihaoDeng 2023-03-05 12:42:56 +08:00
parent e6ec795b4d
commit ee0bf9c501
1 changed files with 24 additions and 12 deletions

View File

@ -1116,18 +1116,18 @@ void cliSend(SCliConn* pConn) {
msgLen = (int32_t)ntohl((uint32_t)(pHead->msgLen)); msgLen = (int32_t)ntohl((uint32_t)(pHead->msgLen));
} }
if (tmsgIsValid(pHead->msgType)) { // if (tmsgIsValid(pHead->msgType)) {
char buf[128] = {0}; // char buf[128] = {0};
sprintf(buf, "%s", TMSG_INFO(pHead->msgType)); // sprintf(buf, "%s", TMSG_INFO(pHead->msgType));
int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); // int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf));
if (NULL == 0) { // if (NULL == 0) {
int localCount = 1; // int localCount = 1;
taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); // taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount));
} else { // } else {
int localCount = *count + 1; // int localCount = *count + 1;
taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); // taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount));
} // }
} // }
tGDebug("%s conn %p %s is sent to %s, local info %s, len:%d", CONN_GET_INST_LABEL(pConn), pConn, tGDebug("%s conn %p %s is sent to %s, local info %s, len:%d", CONN_GET_INST_LABEL(pConn), pConn,
TMSG_INFO(pHead->msgType), pConn->dst, pConn->src, msgLen); TMSG_INFO(pHead->msgType), pConn->dst, pConn->src, msgLen);
@ -1523,6 +1523,18 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
destroyCmsg(pMsg); destroyCmsg(pMsg);
return; return;
} }
if (tmsgIsValid(pMsg->msg.msgType)) {
char buf[128] = {0};
sprintf(buf, "%s", TMSG_INFO(pMsg->msg.msgType));
int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf));
if (NULL == 0) {
int localCount = 1;
taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount));
} else {
int localCount = *count + 1;
taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount));
}
}
char* fqdn = EPSET_GET_INUSE_IP(&pMsg->ctx->epSet); char* fqdn = EPSET_GET_INUSE_IP(&pMsg->ctx->epSet);
uint16_t port = EPSET_GET_INUSE_PORT(&pMsg->ctx->epSet); uint16_t port = EPSET_GET_INUSE_PORT(&pMsg->ctx->epSet);