GetAddrInfo wrapper always numeric

This commit is contained in:
Michael Davidsaver
2025-05-05 08:14:49 -07:00
parent 190eb8750f
commit b8a4001c58
+3 -1
View File
@@ -691,7 +691,9 @@ std::ostream& operator<<(std::ostream& strm, const SockAddr& addr)
GetAddrInfo::GetAddrInfo(const char *name)
{
if(auto err = evutil_getaddrinfo(name, nullptr, nullptr, &info)) {
evutil_addrinfo hints = {};
hints.ai_flags = EVUTIL_AI_NUMERICHOST;
if(auto err = evutil_getaddrinfo(name, nullptr, &hints, &info)) {
throw std::runtime_error(SB()<<"Error resolving \""<<escape(name)<<"\" : "<<evutil_gai_strerror(err));
}
}