refactor transport
This commit is contained in:
parent
32c0c40c4d
commit
ae7d4f1f85
|
@ -435,7 +435,7 @@ bool transEpSetIsEqual2(SEpSet* a, SEpSet* b);
|
||||||
*/
|
*/
|
||||||
void transThreadOnce();
|
void transThreadOnce();
|
||||||
|
|
||||||
void transInit();
|
int32_t transInit();
|
||||||
void transCleanup();
|
void transCleanup();
|
||||||
void transPrintEpSet(SEpSet* pEpSet);
|
void transPrintEpSet(SEpSet* pEpSet);
|
||||||
|
|
||||||
|
|
|
@ -34,10 +34,14 @@ static int32_t transValidLocalFqdn(const char* localFqdn, uint32_t* ip) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
void* rpcOpen(const SRpcInit* pInit) {
|
void* rpcOpen(const SRpcInit* pInit) {
|
||||||
rpcInit();
|
int32_t code = rpcInit();
|
||||||
|
if (code != 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
SRpcInfo* pRpc = taosMemoryCalloc(1, sizeof(SRpcInfo));
|
SRpcInfo* pRpc = taosMemoryCalloc(1, sizeof(SRpcInfo));
|
||||||
if (pRpc == NULL) {
|
if (pRpc == NULL) {
|
||||||
|
// return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (pInit->label) {
|
if (pInit->label) {
|
||||||
|
@ -202,10 +206,8 @@ int32_t rpcCvtErrCode(int32_t code) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t rpcInit() {
|
int32_t rpcInit() { return transInit(); }
|
||||||
transInit();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
void rpcCleanup(void) {
|
void rpcCleanup(void) {
|
||||||
transCleanup();
|
transCleanup();
|
||||||
transHttpEnvDestroy();
|
transHttpEnvDestroy();
|
||||||
|
|
|
@ -692,9 +692,13 @@ static void transDestroyEnv() {
|
||||||
transCloseRefMgt(transSyncMsgMgt);
|
transCloseRefMgt(transSyncMsgMgt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void transInit() {
|
int32_t transInit() {
|
||||||
// init env
|
// init env
|
||||||
taosThreadOnce(&transModuleInit, transInitEnv);
|
int32_t code = taosThreadOnce(&transModuleInit, transInitEnv);
|
||||||
|
if (code != 0) {
|
||||||
|
code = TAOS_SYSTEM_ERROR(errno);
|
||||||
|
}
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t transGetRefMgt() { return refMgt; }
|
int32_t transGetRefMgt() { return refMgt; }
|
||||||
|
|
Loading…
Reference in New Issue