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
end;
is_running(quic, _ListenerId, _Conf) ->
%% TODO: quic support
false.
is_running(quic, ListenerId, _Conf) ->
case quicer:listener(ListenerId) of
{ok, Pid} when is_pid(Pid) ->
true;
_ ->
false
end.
current_conns(ID, ListenOn) ->
{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.
ensure_quic_listener(Name, UdpPort) ->
application:ensure_all_started(quicer),
emqx_config:put([listeners, quic, Name, mountpoint], <<>>),
Conf = #{
acceptors => 16,
bind => {{0, 0, 0, 0}, UdpPort},
@ -545,6 +544,7 @@ ensure_quic_listener(Name, UdpPort) ->
mountpoint => <<>>,
zone => default
},
emqx_config:put([listeners, quic, Name], Conf),
case emqx_listeners:start_listener(quic, Name, Conf) of
ok -> ok;
{error, {already_started, _Pid}} -> ok