[td-225] add error log for socket
This commit is contained in:
parent
70e7a9f21f
commit
97d2f1e425
|
@ -29,11 +29,12 @@ int taosGetFqdn(char *fqdn) {
|
|||
|
||||
hints.ai_flags = AI_CANONNAME;
|
||||
|
||||
getaddrinfo(hostname, NULL, &hints, &result);
|
||||
int32_t ret = getaddrinfo(hostname, NULL, &hints, &result);
|
||||
if (result) {
|
||||
strcpy(fqdn, result->ai_canonname);
|
||||
freeaddrinfo(result);
|
||||
} else {
|
||||
uError("failed to get fqdn, code:%d, reason:%s", ret, gai_strerror(ret));
|
||||
code = -1;
|
||||
}
|
||||
|
||||
|
@ -42,6 +43,9 @@ int taosGetFqdn(char *fqdn) {
|
|||
|
||||
uint32_t taosGetIpFromFqdn(const char *fqdn) {
|
||||
struct addrinfo hints = {0};
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
|
||||
struct addrinfo *result = NULL;
|
||||
|
||||
int32_t ret = getaddrinfo(fqdn, NULL, &hints, &result);
|
||||
|
@ -53,7 +57,7 @@ uint32_t taosGetIpFromFqdn(const char *fqdn) {
|
|||
freeaddrinfo(result);
|
||||
return ip;
|
||||
} else {
|
||||
uError("failed get the addr info, code:%d, reason:%s", ret, gai_strerror(ret));
|
||||
uError("failed get the ip address, fqdn:%s, code:%d, reason:%s", fqdn, ret, gai_strerror(ret));
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue