Otherwise, IsValid crashes on assertation in GetFamilyLength.
llvm-svn: 222862
int ai_protocol,
int ai_flags)
{
+ Clear ();
+
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = ai_family;
hints.ai_protocol = ai_protocol;
hints.ai_flags = ai_flags;
+ bool result = false;
struct addrinfo *service_info_list = NULL;
int err = ::getaddrinfo (host, service, &hints, &service_info_list);
if (err == 0 && service_info_list)
+ {
*this = service_info_list;
- else
- Clear();
+ result = IsValid ();
+ }
:: freeaddrinfo (service_info_list);
- return IsValid();
+ return result;
}