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.
|
%% @doc Add `ipv6_probe' socket option if it's supported.
|
||||||
ipv6_probe(Opts) ->
|
ipv6_probe(Opts) ->
|
||||||
case persistent_term:get({?MODULE, ipv6_probe_supported}, unknown) of
|
Bool = try gen_tcp:ipv6_probe()
|
||||||
unknown ->
|
catch _ : _ -> false end,
|
||||||
%% e.g. 23.2.7.1-emqx-2-x86_64-unknown-linux-gnu-64
|
ipv6_probe(Bool, Opts).
|
||||||
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.
|
|
||||||
|
|
||||||
ipv6_probe(false, Opts) -> Opts;
|
ipv6_probe(false, Opts) -> Opts;
|
||||||
ipv6_probe(true, Opts) -> [{ipv6_probe, true} | Opts].
|
ipv6_probe(true, Opts) -> [{ipv6_probe, true} | Opts].
|
||||||
|
|
Loading…
Reference in New Issue