refact code
This commit is contained in:
parent
3c0114362b
commit
e063a8092c
|
@ -225,6 +225,7 @@ int32_t asyncSendMsgToServerExt(void* pTransporter, SEpSet* epSet, int64_t* pTra
|
||||||
.code = 0
|
.code = 0
|
||||||
};
|
};
|
||||||
TRACE_SET_ROOTID(&rpcMsg.info.traceId, pInfo->requestId);
|
TRACE_SET_ROOTID(&rpcMsg.info.traceId, pInfo->requestId);
|
||||||
|
|
||||||
int code = rpcSendRequestWithCtx(pTransporter, epSet, &rpcMsg, pTransporterId, rpcCtx);
|
int code = rpcSendRequestWithCtx(pTransporter, epSet, &rpcMsg, pTransporterId, rpcCtx);
|
||||||
if (code) {
|
if (code) {
|
||||||
destroySendMsgInfo(pInfo);
|
destroySendMsgInfo(pInfo);
|
||||||
|
@ -448,13 +449,13 @@ void parseTagDatatoJson(void* p, char** jsonStr) {
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if(!cJSON_AddItemToObject(json, tagJsonKey, value)){
|
if (!cJSON_AddItemToObject(json, tagJsonKey, value)) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
} else if (type == TSDB_DATA_TYPE_NCHAR) {
|
} else if (type == TSDB_DATA_TYPE_NCHAR) {
|
||||||
cJSON* value = NULL;
|
cJSON* value = NULL;
|
||||||
if (pTagVal->nData > 0) {
|
if (pTagVal->nData > 0) {
|
||||||
char* tagJsonValue = taosMemoryCalloc(pTagVal->nData, 1);
|
char* tagJsonValue = taosMemoryCalloc(pTagVal->nData, 1);
|
||||||
if (tagJsonValue == NULL) {
|
if (tagJsonValue == NULL) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -479,7 +480,7 @@ void parseTagDatatoJson(void* p, char** jsonStr) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!cJSON_AddItemToObject(json, tagJsonKey, value)){
|
if (!cJSON_AddItemToObject(json, tagJsonKey, value)) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
} else if (type == TSDB_DATA_TYPE_DOUBLE) {
|
} else if (type == TSDB_DATA_TYPE_DOUBLE) {
|
||||||
|
@ -488,7 +489,7 @@ void parseTagDatatoJson(void* p, char** jsonStr) {
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if(!cJSON_AddItemToObject(json, tagJsonKey, value)){
|
if (!cJSON_AddItemToObject(json, tagJsonKey, value)) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
} else if (type == TSDB_DATA_TYPE_BOOL) {
|
} else if (type == TSDB_DATA_TYPE_BOOL) {
|
||||||
|
@ -497,7 +498,7 @@ void parseTagDatatoJson(void* p, char** jsonStr) {
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if(!cJSON_AddItemToObject(json, tagJsonKey, value)){
|
if (!cJSON_AddItemToObject(json, tagJsonKey, value)) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -167,7 +167,11 @@ int32_t rpcSendRequest(void* shandle, const SEpSet* pEpSet, SRpcMsg* pMsg, int64
|
||||||
return transSendRequest(shandle, pEpSet, pMsg, NULL);
|
return transSendRequest(shandle, pEpSet, pMsg, NULL);
|
||||||
}
|
}
|
||||||
int32_t rpcSendRequestWithCtx(void* shandle, const SEpSet* pEpSet, SRpcMsg* pMsg, int64_t* pRid, SRpcCtx* pCtx) {
|
int32_t rpcSendRequestWithCtx(void* shandle, const SEpSet* pEpSet, SRpcMsg* pMsg, int64_t* pRid, SRpcCtx* pCtx) {
|
||||||
return transSendRequest(shandle, pEpSet, pMsg, pCtx);
|
if (pCtx != NULL) {
|
||||||
|
return transSendRequest(shandle, pEpSet, pMsg, pCtx);
|
||||||
|
} else {
|
||||||
|
return transSendRequestWithId(shandle, pEpSet, pMsg, pRid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t rpcSendRequestWithId(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, int64_t* transpointId) {
|
int32_t rpcSendRequestWithId(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, int64_t* transpointId) {
|
||||||
|
@ -178,7 +182,7 @@ int32_t rpcSendRecv(void* shandle, SEpSet* pEpSet, SRpcMsg* pMsg, SRpcMsg* pRsp)
|
||||||
return transSendRecv(shandle, pEpSet, pMsg, pRsp);
|
return transSendRecv(shandle, pEpSet, pMsg, pRsp);
|
||||||
}
|
}
|
||||||
int32_t rpcSendRecvWithTimeout(void* shandle, SEpSet* pEpSet, SRpcMsg* pMsg, SRpcMsg* pRsp, int8_t* epUpdated,
|
int32_t rpcSendRecvWithTimeout(void* shandle, SEpSet* pEpSet, SRpcMsg* pMsg, SRpcMsg* pRsp, int8_t* epUpdated,
|
||||||
int32_t timeoutMs) {
|
int32_t timeoutMs) {
|
||||||
return transSendRecvWithTimeout(shandle, pEpSet, pMsg, pRsp, epUpdated, timeoutMs);
|
return transSendRecvWithTimeout(shandle, pEpSet, pMsg, pRsp, epUpdated, timeoutMs);
|
||||||
}
|
}
|
||||||
int32_t rpcFreeConnById(void* shandle, int64_t connId) { return transFreeConnById(shandle, connId); }
|
int32_t rpcFreeConnById(void* shandle, int64_t connId) { return transFreeConnById(shandle, connId); }
|
||||||
|
|
Loading…
Reference in New Issue