[td-225] add error output for getaddrinfo
This commit is contained in:
parent
c29ff049f2
commit
70e7a9f21f
|
@ -493,7 +493,7 @@ static SRpcConn *rpcOpenConn(SRpcInfo *pRpc, char *peerFqdn, uint16_t peerPort,
|
|||
SRpcConn *pConn;
|
||||
|
||||
uint32_t peerIp = taosGetIpFromFqdn(peerFqdn);
|
||||
if (peerIp == -1) {
|
||||
if (peerIp == 0xFFFFFFFF) {
|
||||
tError("%s, failed to resolve FQDN:%s", pRpc->label, peerFqdn);
|
||||
terrno = TSDB_CODE_RPC_APP_ERROR;
|
||||
return NULL;
|
||||
|
|
|
@ -44,7 +44,7 @@ uint32_t taosGetIpFromFqdn(const char *fqdn) {
|
|||
struct addrinfo hints = {0};
|
||||
struct addrinfo *result = NULL;
|
||||
|
||||
getaddrinfo(fqdn, NULL, &hints, &result);
|
||||
int32_t ret = getaddrinfo(fqdn, NULL, &hints, &result);
|
||||
if (result) {
|
||||
struct sockaddr *sa = result->ai_addr;
|
||||
struct sockaddr_in *si = (struct sockaddr_in*)sa;
|
||||
|
@ -53,7 +53,8 @@ uint32_t taosGetIpFromFqdn(const char *fqdn) {
|
|||
freeaddrinfo(result);
|
||||
return ip;
|
||||
} else {
|
||||
return -1;
|
||||
uError("failed get the addr info, code:%d, reason:%s", ret, gai_strerror(ret));
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue