enh: return code of get ip from fqdn
This commit is contained in:
parent
a7c54f19a0
commit
2239a924f0
|
@ -941,7 +941,7 @@ int32_t taosBlockSIGPIPE() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t taosGetIpv4FromFqdn(const char *fqdn, uint32_t* ip) {
|
int32_t taosGetIpv4FromFqdn(const char *fqdn, uint32_t *ip) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
// Initialize Winsock
|
// Initialize Winsock
|
||||||
WSADATA wsaData;
|
WSADATA wsaData;
|
||||||
|
@ -959,8 +959,8 @@ int32_t taosGetIpv4FromFqdn(const char *fqdn, uint32_t* ip) {
|
||||||
hints.ai_socktype = SOCK_STREAM;
|
hints.ai_socktype = SOCK_STREAM;
|
||||||
|
|
||||||
struct addrinfo *result = NULL;
|
struct addrinfo *result = NULL;
|
||||||
bool inRetry = false;
|
bool inRetry = false;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
int32_t ret = getaddrinfo(fqdn, NULL, &hints, &result);
|
int32_t ret = getaddrinfo(fqdn, NULL, &hints, &result);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -972,7 +972,7 @@ int32_t taosGetIpv4FromFqdn(const char *fqdn, uint32_t* ip) {
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
terrno = TAOS_SYSTEM_ERROR(ret);
|
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1011,7 +1011,7 @@ int32_t taosGetIpv4FromFqdn(const char *fqdn, uint32_t* ip) {
|
||||||
#else
|
#else
|
||||||
// printf("failed to get the ip address, fqdn:%s, ret:%d, since:%s", fqdn, ret, gai_strerror(ret));
|
// printf("failed to get the ip address, fqdn:%s, ret:%d, since:%s", fqdn, ret, gai_strerror(ret));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*ip = 0xFFFFFFFF;
|
*ip = 0xFFFFFFFF;
|
||||||
return 0xFFFFFFFF;
|
return 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue