Merge pull request #12215 from taosdata/fix/invaldFqdn
fix(rpc): fix invalide fqdn
This commit is contained in:
commit
ba7bd35a39
|
@ -850,7 +850,8 @@ 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());
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
tError("invalid ip/port, reason: %s", terrstr());
|
||||
goto End;
|
||||
}
|
||||
if (false == addHandleToAcceptloop(srv)) {
|
||||
|
|
|
@ -669,7 +669,7 @@ bool taosValidIpAndPort(uint32_t ip, uint16_t port) {
|
|||
if (taosSetSockOpt(pSocket, SOL_SOCKET, SO_REUSEADDR, (void *)&reuse, sizeof(reuse)) < 0) {
|
||||
// printf("setsockopt SO_REUSEADDR failed: %d (%s)", errno, strerror(errno));
|
||||
taosCloseSocket(&pSocket);
|
||||
return NULL;
|
||||
return false;
|
||||
}
|
||||
/* bind socket to server address */
|
||||
if (bind(pSocket->fd, (struct sockaddr *)&serverAdd, sizeof(serverAdd)) < 0) {
|
||||
|
@ -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 false;
|
||||
}
|
||||
taosCloseSocket(&pSocket);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue