feat(quic): fix some listener

This commit is contained in:
William Yang 2022-06-09 17:52:27 +02:00
parent 6349b5e5e0
commit 96a510fbf1
2 changed files with 8 additions and 4 deletions

View File

@ -143,9 +143,13 @@ is_running(Type, ListenerId, _Conf) when Type =:= ws; Type =:= wss ->
_:_ -> _:_ ->
false false
end; end;
is_running(quic, _ListenerId, _Conf) -> is_running(quic, ListenerId, _Conf) ->
%% TODO: quic support case quicer:listener(ListenerId) of
false. {ok, Pid} when is_pid(Pid) ->
true;
_ ->
false
end.
current_conns(ID, ListenOn) -> current_conns(ID, ListenOn) ->
{ok, #{type := Type, name := Name}} = parse_listener_id(ID), {ok, #{type := Type, name := Name}} = parse_listener_id(ID),

View File

@ -526,7 +526,6 @@ ensure_dashboard_listeners_started(_App) ->
-spec ensure_quic_listener(Name :: atom(), UdpPort :: inet:port_number()) -> ok. -spec ensure_quic_listener(Name :: atom(), UdpPort :: inet:port_number()) -> ok.
ensure_quic_listener(Name, UdpPort) -> ensure_quic_listener(Name, UdpPort) ->
application:ensure_all_started(quicer), application:ensure_all_started(quicer),
emqx_config:put([listeners, quic, Name, mountpoint], <<>>),
Conf = #{ Conf = #{
acceptors => 16, acceptors => 16,
bind => {{0, 0, 0, 0}, UdpPort}, bind => {{0, 0, 0, 0}, UdpPort},
@ -545,6 +544,7 @@ ensure_quic_listener(Name, UdpPort) ->
mountpoint => <<>>, mountpoint => <<>>,
zone => default zone => default
}, },
emqx_config:put([listeners, quic, Name], Conf),
case emqx_listeners:start_listener(quic, Name, Conf) of case emqx_listeners:start_listener(quic, Name, Conf) of
ok -> ok; ok -> ok;
{error, {already_started, _Pid}} -> ok {error, {already_started, _Pid}} -> ok