Merge pull request #4623 from taosdata/fix/TD-2484
[TD-2484]<fix>: use IPv4's AI_INET instead of AI_UNSPEC
This commit is contained in:
commit
39c5acba30
|
@ -195,7 +195,7 @@ static void addRuntimeInfo(SBufferWriter* bw) {
|
|||
|
||||
static void sendTelemetryReport() {
|
||||
char buf[128];
|
||||
uint32_t ip = taosGetIpFromFqdn(TELEMETRY_SERVER);
|
||||
uint32_t ip = taosGetIpv4FromFqdn(TELEMETRY_SERVER);
|
||||
if (ip == 0xffffffff) {
|
||||
dTrace("failed to get IP address of " TELEMETRY_SERVER ", reason:%s", strerror(errno));
|
||||
return;
|
||||
|
@ -308,4 +308,4 @@ void dnodeCleanupTelemetry() {
|
|||
pthread_join(tsTelemetryThread, NULL);
|
||||
tsem_destroy(&tsExitSem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -576,7 +576,7 @@ static void rpcFreeMsg(void *msg) {
|
|||
static SRpcConn *rpcOpenConn(SRpcInfo *pRpc, char *peerFqdn, uint16_t peerPort, int8_t connType) {
|
||||
SRpcConn *pConn;
|
||||
|
||||
uint32_t peerIp = taosGetIpFromFqdn(peerFqdn);
|
||||
uint32_t peerIp = taosGetIpv4FromFqdn(peerFqdn);
|
||||
if (peerIp == 0xFFFFFFFF) {
|
||||
tError("%s, failed to resolve FQDN:%s", pRpc->label, peerFqdn);
|
||||
terrno = TSDB_CODE_RPC_FQDN_ERROR;
|
||||
|
|
|
@ -486,7 +486,7 @@ static void syncRemovePeer(SSyncPeer *pPeer) {
|
|||
}
|
||||
|
||||
static SSyncPeer *syncAddPeer(SSyncNode *pNode, const SNodeInfo *pInfo) {
|
||||
uint32_t ip = taosGetIpFromFqdn(pInfo->nodeFqdn);
|
||||
uint32_t ip = taosGetIpv4FromFqdn(pInfo->nodeFqdn);
|
||||
if (ip == 0xFFFFFFFF) {
|
||||
sError("failed to add peer, can resolve fqdn:%s since %s", pInfo->nodeFqdn, strerror(errno));
|
||||
terrno = TSDB_CODE_RPC_FQDN_ERROR;
|
||||
|
|
|
@ -33,7 +33,7 @@ SOCKET taosOpenTcpServerSocket(uint32_t ip, uint16_t port);
|
|||
int32_t taosKeepTcpAlive(SOCKET sockFd);
|
||||
|
||||
int32_t taosGetFqdn(char *);
|
||||
uint32_t taosGetIpFromFqdn(const char *);
|
||||
uint32_t taosGetIpv4FromFqdn(const char *);
|
||||
void tinet_ntoa(char *ipstr, uint32_t ip);
|
||||
uint32_t ip2uint(const char *const ip_addr);
|
||||
|
||||
|
|
|
@ -449,7 +449,7 @@ static void taosNetTestClient(char *host, int32_t startPort, int32_t pkgLen) {
|
|||
int32_t endPort = startPort + 11;
|
||||
uInfo("work as client, host:%s startPort:%d endPort:%d pkgLen:%d\n", host, startPort, endPort, pkgLen);
|
||||
|
||||
uint32_t serverIp = taosGetIpFromFqdn(host);
|
||||
uint32_t serverIp = taosGetIpv4FromFqdn(host);
|
||||
if (serverIp == 0xFFFFFFFF) {
|
||||
uError("failed to resolve fqdn:%s", host);
|
||||
exit(-1);
|
||||
|
|
|
@ -40,9 +40,9 @@ int32_t taosGetFqdn(char *fqdn) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint32_t taosGetIpFromFqdn(const char *fqdn) {
|
||||
uint32_t taosGetIpv4FromFqdn(const char *fqdn) {
|
||||
struct addrinfo hints = {0};
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_family = AF_INET;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
|
||||
struct addrinfo *result = NULL;
|
||||
|
|
Loading…
Reference in New Issue