Upgrade deps to ekka v0.7.0 and esockd v5.6.0

This commit is contained in:
Feng Lee 2019-11-18 10:40:53 +08:00
parent dc7c39d479
commit 4935ba11a8
6 changed files with 12 additions and 11 deletions

View File

@ -1,11 +1,11 @@
{minimum_otp_vsn, "21.0"}.
{deps,
[{jsx, "2.9.0"}, % hex
{cowboy, "2.6.1"}, % hex
{gproc, "0.8.0"}, % hex
{esockd, {git, "https://github.com/emqx/esockd", {tag, "v5.5.2"}}},
{ekka, {git, "https://github.com/emqx/ekka", {tag, "v0.6.2"}}},
[{jsx, "2.10.0"},
{cowboy, "2.7.0"},
{gproc, "0.8.0"},
{esockd, {git, "https://github.com/emqx/esockd", {tag, "5.6.0"}}},
{ekka, {git, "https://github.com/emqx/ekka", {tag, "0.7.0"}}},
{gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.4.1"}}},
{cuttlefish, {git, "https://github.com/emqx/cuttlefish", {tag, "v3.0.0"}}}
]}.

View File

@ -101,7 +101,8 @@
-spec(start_link(esockd:transport(), esockd:socket(), proplists:proplist())
-> {ok, pid()}).
start_link(Transport, Socket, Options) ->
CPid = proc_lib:spawn_link(?MODULE, init, [self(), Transport, Socket, Options]),
Args = [self(), Transport, Socket, Options],
CPid = proc_lib:spawn_link(?MODULE, init, Args),
{ok, CPid}.
%%--------------------------------------------------------------------
@ -196,7 +197,7 @@ do_init(Parent, Transport, Socket, Options) ->
IdleTimeout = emqx_zone:idle_timeout(Zone),
IdleTimer = start_timer(IdleTimeout, idle_timeout),
emqx_misc:tune_heap_size(emqx_zone:oom_policy(Zone)),
emqx_logger:set_metadata_peername(esockd_net:format(Peername)),
emqx_logger:set_metadata_peername(esockd:format(Peername)),
State = #state{transport = Transport,
socket = Socket,
peername = Peername,

View File

@ -140,7 +140,7 @@ handle_cast({detected, Flapping = #flapping{clientid = ClientId,
true -> %% Flapping happened:(
%% Log first
?LOG(error, "Flapping detected: ~s(~s) disconnected ~w times in ~wms",
[ClientId, esockd_net:ntoa(PeerHost), DetectCnt, Duration]),
[ClientId, inet:ntoa(PeerHost), DetectCnt, Duration]),
%% Banned.
BannedFlapping = Flapping#flapping{clientid = {banned, ClientId},
banned_at = erlang:system_time(millisecond)

View File

@ -176,5 +176,5 @@ format(Port) when is_integer(Port) ->
format({Addr, Port}) when is_list(Addr) ->
io_lib:format("~s:~w", [Addr, Port]);
format({Addr, Port}) when is_tuple(Addr) ->
io_lib:format("~s:~w", [esockd_net:ntoab(Addr), Port]).
io_lib:format("~s:~w", [inet:ntoab(Addr), Port]).

View File

@ -112,5 +112,5 @@ reason({Error, _}) when is_atom(Error) -> Error;
reason(_) -> internal_error.
-compile({inline, [ntoa/1]}).
ntoa(IpAddr) -> iolist_to_binary(esockd_net:ntoa(IpAddr)).
ntoa(IpAddr) -> iolist_to_binary(inet:ntoa(IpAddr)).

View File

@ -218,7 +218,7 @@ websocket_init([Req, Opts]) ->
IdleTimeout = emqx_zone:idle_timeout(Zone),
IdleTimer = start_timer(IdleTimeout, idle_timeout),
emqx_misc:tune_heap_size(emqx_zone:oom_policy(Zone)),
emqx_logger:set_metadata_peername(esockd_net:format(Peername)),
emqx_logger:set_metadata_peername(esockd:format(Peername)),
{ok, #state{peername = Peername,
sockname = Sockname,
sockstate = running,