Move 'family' copying after all address checks

Fix #495
This commit is contained in:
Diadlo 2017-03-04 08:59:52 +03:00
parent def92ab029
commit f91af5c93a
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727

View File

@ -1242,8 +1242,6 @@ int32_t net_getipport(const char* node, IP_Port** res, int type)
IP_Port *ip_port = *res;
for (cur = infos; cur != NULL; cur = cur->ai_next) {
ip_port->ip.family = cur->ai_family;
if (cur->ai_socktype && type > 0 && cur->ai_socktype != type) {
continue;
}
@ -1258,6 +1256,8 @@ int32_t net_getipport(const char* node, IP_Port** res, int type)
continue;
}
ip_port->ip.family = cur->ai_family;
ip_port++;
}