fix(emqx_misc): call gen_tcp to decide if ipv6_probe is supported
This commit is contained in:
parent
a178b6cc08
commit
2dc63cffea
|
@ -66,16 +66,9 @@ maybe_parse_ip(Host) ->
|
|||
|
||||
%% @doc Add `ipv6_probe' socket option if it's supported.
|
||||
ipv6_probe(Opts) ->
|
||||
case persistent_term:get({?MODULE, ipv6_probe_supported}, unknown) of
|
||||
unknown ->
|
||||
%% e.g. 23.2.7.1-emqx-2-x86_64-unknown-linux-gnu-64
|
||||
OtpVsn = emqx_vm:get_otp_version(),
|
||||
Bool = (match =:= re:run(OtpVsn, "emqx", [{capture, none}])),
|
||||
_ = persistent_term:put({?MODULE, ipv6_probe_supported}, Bool),
|
||||
ipv6_probe(Bool, Opts);
|
||||
Bool ->
|
||||
ipv6_probe(Bool, Opts)
|
||||
end.
|
||||
Bool = try gen_tcp:ipv6_probe()
|
||||
catch _ : _ -> false end,
|
||||
ipv6_probe(Bool, Opts).
|
||||
|
||||
ipv6_probe(false, Opts) -> Opts;
|
||||
ipv6_probe(true, Opts) -> [{ipv6_probe, true} | Opts].
|
||||
|
|
Loading…
Reference in New Issue