mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-11 05:14:46 -04:00
evutil: set the have_checked_interfaces in evutil_check_interfaces()
Closes: #836 (cherry-picked) Fixes: #834 (cherry picked from commit 0de2b1455b348466e8e29704ba8760127cd63528)
This commit is contained in:
parent
2d65071c3a
commit
ef498aa25d
6
evutil.c
6
evutil.c
@ -761,6 +761,9 @@ evutil_check_interfaces(int force_recheck)
|
||||
if (have_checked_interfaces && !force_recheck)
|
||||
return 0;
|
||||
|
||||
/* From this point on we have done the ipv4/ipv6 interface check */
|
||||
have_checked_interfaces = 1;
|
||||
|
||||
if (evutil_check_ifaddrs() == 0) {
|
||||
/* Use a nice sane interface, if this system has one. */
|
||||
return 0;
|
||||
@ -1228,8 +1231,7 @@ evutil_adjust_hints_for_addrconfig_(struct evutil_addrinfo *hints)
|
||||
return;
|
||||
if (hints->ai_family != PF_UNSPEC)
|
||||
return;
|
||||
if (!have_checked_interfaces)
|
||||
evutil_check_interfaces(0);
|
||||
evutil_check_interfaces(0);
|
||||
if (had_ipv4_address && !had_ipv6_address) {
|
||||
hints->ai_family = PF_INET;
|
||||
} else if (!had_ipv4_address && had_ipv6_address) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user