diff --git a/source/libs/transport/src/transSrv.c b/source/libs/transport/src/transSrv.c index 604764388186722eb7d3ea374ee9e0b867bf1899..d4286f59163bce6d89048d1ccf47f0c807ffa67d 100644 --- a/source/libs/transport/src/transSrv.c +++ b/source/libs/transport/src/transSrv.c @@ -850,7 +850,7 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, } } if (false == taosValidIpAndPort(srv->ip, srv->port)) { - tError("failed to bind, reason: %s", terrstr()); + tError("failed to bind, reason: %s", strerror(TAOS_SYSTEM_ERROR(errno))); goto End; } if (false == addHandleToAcceptloop(srv)) { diff --git a/source/os/src/osSocket.c b/source/os/src/osSocket.c index 8cac660039a0fbba90a3e69c48be619a6c7b29cc..addc006e29d1931fd4af29876b276cfb9172e2cc 100644 --- a/source/os/src/osSocket.c +++ b/source/os/src/osSocket.c @@ -677,6 +677,11 @@ bool taosValidIpAndPort(uint32_t ip, uint16_t port) { taosCloseSocket(&pSocket); return false; } + if (listen(pSocket->fd, 1024) < 0) { + // printf("listen tcp server socket failed, 0x%x:%hu(%s)", ip, port, strerror(errno)); + taosCloseSocket(&pSocket); + return NULL; + } taosCloseSocket(&pSocket); return true; }