diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c index 3c4eb4a4471f205a8fc50116836916aeff05e105..40265965481654736e8d8b7448c369bd1918e573 100644 --- a/source/libs/sync/src/syncUtil.c +++ b/source/libs/sync/src/syncUtil.c @@ -14,7 +14,6 @@ */ #include "syncUtil.h" -#include #include #include "syncEnv.h" @@ -24,6 +23,14 @@ void addEpIntoEpSet(SEpSet* pEpSet, const char* fqdn, uint16_t port); // ---- encode / decode uint64_t syncUtilAddr2U64(const char* host, uint16_t port) { uint64_t u64; + + uint32_t hostU32 = taosGetIpv4FromFqdn(host); + if (hostU32 == (uint32_t)-1) { + sError("Get IP address error"); + return -1; + } + + /* uint32_t hostU32 = (uint32_t)taosInetAddr(host); if (hostU32 == (uint32_t)-1) { struct hostent* hostEnt = gethostbyname(host); @@ -39,6 +46,8 @@ uint64_t syncUtilAddr2U64(const char* host, uint16_t port) { } // ASSERT(hostU32 != (uint32_t)-1); } + */ + u64 = (((uint64_t)hostU32) << 32) | (((uint32_t)port) << 16); return u64; }