#2470 failed to listen without closing the socket

This commit is contained in:
Shengliang Guan 2020-07-09 10:24:54 +08:00
parent 05ea1e42f0
commit c98767fdf0
1 changed files with 6 additions and 1 deletions

View File

@ -383,10 +383,15 @@ int taosOpenTcpServerSocket(uint32_t ip, uint16_t port) {
return -1;
}
if (taosKeepTcpAlive(sockFd) < 0) return -1;
if (taosKeepTcpAlive(sockFd) < 0) {
uError("failed to set tcp server keep-alive option, 0x%x:%hu(%s)", ip, port, strerror(errno));
close(sockFd);
return -1;
}
if (listen(sockFd, 10) < 0) {
uError("listen tcp server socket failed, 0x%x:%hu(%s)", ip, port, strerror(errno));
close(sockFd);
return -1;
}