Merge pull request #6110 from HJianBo/force-clear-stomp-listener
fix(emqx_stomp): fix hot-upgrade stopping listener failed
This commit is contained in:
commit
a81140fd00
|
@ -2,7 +2,8 @@
|
||||||
{VSN,
|
{VSN,
|
||||||
[{"4.3.1",[{load_module,emqx_stomp_connection,brutal_purge,soft_purge,[]}]},
|
[{"4.3.1",[{load_module,emqx_stomp_connection,brutal_purge,soft_purge,[]}]},
|
||||||
{"4.3.0",
|
{"4.3.0",
|
||||||
[{restart_application,emqx_stomp}]},
|
[{restart_application,emqx_stomp},
|
||||||
|
{apply,{emqx_stomp,force_clear_after_app_stoped,[]}}]},
|
||||||
{<<".*">>,[]}],
|
{<<".*">>,[]}],
|
||||||
[{"4.3.1",[{load_module,emqx_stomp_connection,brutal_purge,soft_purge,[]}]},
|
[{"4.3.1",[{load_module,emqx_stomp_connection,brutal_purge,soft_purge,[]}]},
|
||||||
{"4.3.0",
|
{"4.3.0",
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
, stop_listener/3
|
, stop_listener/3
|
||||||
]).
|
]).
|
||||||
|
|
||||||
|
-export([force_clear_after_app_stoped/0]).
|
||||||
|
|
||||||
-export([init/1]).
|
-export([init/1]).
|
||||||
|
|
||||||
-define(APP, ?MODULE).
|
-define(APP, ?MODULE).
|
||||||
|
@ -52,6 +54,18 @@ start(_StartType, _StartArgs) ->
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
stop_listeners().
|
stop_listeners().
|
||||||
|
|
||||||
|
force_clear_after_app_stoped() ->
|
||||||
|
lists:foreach(fun({Name = {ProtoName, _}, _}) ->
|
||||||
|
case is_stomp_listener(ProtoName) of
|
||||||
|
true -> esockd:close(Name);
|
||||||
|
_ -> ok
|
||||||
|
end
|
||||||
|
end, esockd:listeners()).
|
||||||
|
|
||||||
|
is_stomp_listener('stomp:tcp') -> true;
|
||||||
|
is_stomp_listener('stomp:ssl') -> true;
|
||||||
|
is_stomp_listener(_) -> false.
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Supervisor callbacks
|
%% Supervisor callbacks
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue