Merge pull request #19197 from taosdata/TD-21541
fix: change system error code and avoid mem leak
This commit is contained in:
commit
d731d36093
|
@ -268,6 +268,11 @@ int mainWindows(int argc, char **argv) {
|
|||
|
||||
if (dmInit() != 0) {
|
||||
dError("failed to init dnode since %s", terrstr());
|
||||
|
||||
taosCleanupCfg();
|
||||
taosCloseLog();
|
||||
taosCleanupArgs();
|
||||
taosConvDestroy();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1001,6 +1001,13 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
|
|||
uv_loop_init(srv->loop);
|
||||
|
||||
char pipeName[PATH_MAX];
|
||||
|
||||
if (false == taosValidIpAndPort(srv->ip, srv->port)) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
tError("invalid ip/port, %d:%d, reason:%s", srv->ip, srv->port, terrstr());
|
||||
goto End;
|
||||
}
|
||||
|
||||
#if defined(WINDOWS) || defined(DARWIN)
|
||||
int ret = uv_pipe_init(srv->loop, &srv->pipeListen, 0);
|
||||
if (ret != 0) {
|
||||
|
@ -1087,12 +1094,6 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
|
|||
}
|
||||
#endif
|
||||
|
||||
if (false == taosValidIpAndPort(srv->ip, srv->port)) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
tError("invalid ip/port, %d:%d, reason:%s", srv->ip, srv->port, terrstr());
|
||||
goto End;
|
||||
}
|
||||
|
||||
if (false == addHandleToAcceptloop(srv)) {
|
||||
goto End;
|
||||
}
|
||||
|
@ -1185,8 +1186,8 @@ void transCloseServer(void* arg) {
|
|||
// impl later
|
||||
SServerObj* srv = arg;
|
||||
|
||||
tDebug("send quit msg to accept thread");
|
||||
if (srv->inited) {
|
||||
tDebug("send quit msg to accept thread");
|
||||
uv_async_send(srv->pAcceptAsync);
|
||||
taosThreadJoin(srv->thread, NULL);
|
||||
SRV_RELEASE_UV(srv->loop);
|
||||
|
|
|
@ -643,13 +643,10 @@ const char* tstrerror(int32_t err) {
|
|||
// this is a system errno
|
||||
if ((err & 0x00ff0000) == 0x00ff0000) {
|
||||
int32_t code = err & 0x0000ffff;
|
||||
if (code >= 0 && code < 36) {
|
||||
return strerror(code);
|
||||
} else {
|
||||
return "unknown err";
|
||||
}
|
||||
// strerror can handle any invalid code
|
||||
// invalid code return Unknown error
|
||||
return strerror(code);
|
||||
}
|
||||
|
||||
int32_t s = 0;
|
||||
int32_t e = sizeof(errors) / sizeof(errors[0]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue