Bug fixes

- Support IPv4-only systems
- Fix "~" log message crash in tell/2,3
This commit is contained in:
Craig Everett 2022-11-21 09:58:36 +09:00
parent 5fbaebdc26
commit c7d7cda7c2
54 changed files with 55 additions and 25 deletions

View File

@ -3,7 +3,7 @@
# A convenience script that will download the ZX installer, unpack it, and clean up.
# For maximum portability this script uses the gzipped package version.
version=0.12.6
version=0.12.7
zx="zx-$version"
tarball="$zx.tar.gz"
target="https://zxq9.com/projects/zomp/$tarball"

View File

@ -1 +1 @@
0.12.6
0.12.7

View File

@ -1,6 +1,6 @@
{application,zx,
[{description,"An Erlang development tool and Zomp user client"},
{vsn,"0.12.6"},
{vsn,"0.12.7"},
{applications,[stdlib,kernel]},
{modules,[zx,zx_auth,zx_conn,zx_conn_sup,zx_daemon,zx_key,
zx_lib,zx_local,zx_net,zx_peer,zx_peer_man,

View File

@ -49,8 +49,8 @@ tell(Level, Message) when is_atom(Level) ->
tell(Level, Format, Args) ->
ok = log(Level, Format, Args),
Out = io_lib:format(Format, Args),
Message = unicode:characters_to_list([Out, "~n"]),
io:format(Message).
Message = unicode:characters_to_list([Out, "\n"]),
io:put_chars(Message).
%-spec show(Parent, Format, Args) -> ok

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -24,7 +24,7 @@
%%% @end
-module(zx).
-vsn("0.12.6").
-vsn("0.12.7").
-behavior(application).
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("Craig Everett <zxq9@zxq9.com>").

View File

@ -9,7 +9,7 @@
%%% @end
-module(zx_auth).
-vsn("0.12.6").
-vsn("0.12.7").
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("Craig Everett <zxq9@zxq9.com>").
-license("GPL-3.0").

View File

@ -7,7 +7,7 @@
%%% @end
-module(zx_conn).
-vsn("0.12.6").
-vsn("0.12.7").
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("Craig Everett <zxq9@zxq9.com>").
-license("GPL-3.0").

View File

@ -5,7 +5,7 @@
%%% @end
-module(zx_conn_sup).
-vsn("0.12.6").
-vsn("0.12.7").
-behavior(supervisor).
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("Craig Everett <zxq9@zxq9.com>").

View File

@ -138,7 +138,7 @@
%%% @end
-module(zx_daemon).
-vsn("0.12.6").
-vsn("0.12.7").
-behavior(gen_server).
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("Craig Everett <zxq9@zxq9.com>").

View File

@ -8,7 +8,7 @@
%%% @end
-module(zx_key).
-vsn("0.12.6").
-vsn("0.12.7").
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("Craig Everett <zxq9@zxq9.com>").
-license("GPL-3.0").

View File

@ -10,7 +10,7 @@
%%% @end
-module(zx_lib).
-vsn("0.12.6").
-vsn("0.12.7").
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("Craig Everett <zxq9@zxq9.com>").
-license("GPL-3.0").

View File

@ -6,7 +6,7 @@
%%% @end
-module(zx_local).
-vsn("0.12.6").
-vsn("0.12.7").
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("Craig Everett <zxq9@zxq9.com>").
-license("GPL-3.0").

View File

@ -5,7 +5,7 @@
%%% @end
-module(zx_net).
-vsn("0.12.6").
-vsn("0.12.7").
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("Craig Everett <zxq9@zxq9.com>").
-license("GPL-3.0").

View File

@ -8,7 +8,7 @@
%%% @end
-module(zx_peer).
-vsn("0.12.6").
-vsn("0.12.7").
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("Craig Everett <zxq9@zxq9.com>").
-license("GPL-3.0").

View File

@ -9,7 +9,7 @@
%%% @end
-module(zx_peer_man).
-vsn("0.12.6").
-vsn("0.12.7").
-behavior(gen_server).
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("Craig Everett <zxq9@zxq9.com>").
@ -231,7 +231,21 @@ do_listen(State = #s{listener = none}) ->
{keepalive, true},
{reuseaddr, true},
{packet, 4}],
{ok, Listener} = gen_tcp:listen(0, Options),
{ok, Listener} =
case gen_tcp:listen(0, Options) of
{ok, L} ->
{ok, L};
{error, eafnosupport} ->
AncientOptions =
[inet,
{ip, {127,0,0,1}},
{active, true},
{mode, binary},
{keepalive, true},
{reuseaddr, true},
{packet, 4}],
gen_tcp:listen(0, AncientOptions)
end,
{ok, Port} = inet:port(Listener),
{ok, _} = zx_peer:start(Listener),
{{ok, Port}, State#s{listener = Listener}};

View File

@ -6,7 +6,7 @@
%%% @end
-module(zx_peer_sup).
-vsn("0.12.6").
-vsn("0.12.7").
-behaviour(supervisor).
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("Craig Everett <zxq9@zxq9.com>").

View File

@ -10,7 +10,7 @@
%%% @end
-module(zx_peers).
-vsn("0.12.6").
-vsn("0.12.7").
-behavior(supervisor).
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("Craig Everett <zxq9@zxq9.com>").

View File

@ -5,7 +5,7 @@
%%% @end
-module(zx_proxy).
-vsn("0.12.6").
-vsn("0.12.7").
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("Craig Everett <zxq9@zxq9.com>").
-license("GPL-3.0").
@ -207,6 +207,22 @@ connect(Port, State = #s{socket = none}) ->
case gen_tcp:connect({0,0,0,0,0,0,0,1}, Port, Options) of
{ok, Socket} ->
{ok, State#s{socket = Socket}};
{error, eafnosupport} ->
AncientOptions =
[inet,
{ip, {127,0,0,1}},
{active, true},
{mode, binary},
{keepalive, true},
{reuseaddr, true},
{packet, 4}],
case gen_tcp:connect({127,0,0,1}, Port, AncientOptions) of
{ok, Socket} ->
{ok, State#s{socket = Socket}};
{error, Reason} ->
ok = log(warning, "Connect to local proxy failed with ~tp.", [Reason]),
{error, State}
end;
{error, Reason} ->
ok = log(warning, "Connect to local proxy failed with ~tp.", [Reason]),
{error, State}

View File

@ -5,7 +5,7 @@
%%% @end
-module(zx_sup).
-vsn("0.12.6").
-vsn("0.12.7").
-behavior(supervisor).
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("Craig Everett <zxq9@zxq9.com>").

View File

@ -6,7 +6,7 @@
%%% @end
-module(zx_tty).
-vsn("0.12.6").
-vsn("0.12.7").
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("Craig Everett <zxq9@zxq9.com>").
-license("GPL-3.0").

View File

@ -5,7 +5,7 @@
%%% @end
-module(zx_userconf).
-vsn("0.12.6").
-vsn("0.12.7").
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("Craig Everett <zxq9@zxq9.com>").
-license("GPL-3.0").

View File

@ -7,7 +7,7 @@
%%% @end
-module(zx_zsp).
-vsn("0.12.6").
-vsn("0.12.7").
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("Craig Everett <zxq9@zxq9.com>").
-license("GPL-3.0").

View File

@ -9,7 +9,7 @@
{license,"MIT"}.
{modules,[]}.
{name,"zx"}.
{package_id,{"otpr","zx",{0,12,6}}}.
{package_id,{"otpr","zx",{0,12,7}}}.
{prefix,"zx_"}.
{repo_url,"https://gitlab.com/zxq9/zx"}.
{tags,["tools","package manager","erlang"]}.