|
@@ -178,24 +178,23 @@ do_start_listener(Type, ListenerName, #{bind := ListenOn} = Opts)
|
|
|
do_start_listener(quic, ListenerName, #{bind := ListenOn} = Opts) ->
|
|
do_start_listener(quic, ListenerName, #{bind := ListenOn} = Opts) ->
|
|
|
case [ A || {quicer, _, _} = A<-application:which_applications() ] of
|
|
case [ A || {quicer, _, _} = A<-application:which_applications() ] of
|
|
|
[_] ->
|
|
[_] ->
|
|
|
- %% @fixme unsure why we need reopen lib and reopen config.
|
|
|
|
|
- quicer_nif:open_lib(),
|
|
|
|
|
- quicer_nif:reg_open(),
|
|
|
|
|
DefAcceptors = erlang:system_info(schedulers_online) * 8,
|
|
DefAcceptors = erlang:system_info(schedulers_online) * 8,
|
|
|
ListenOpts = [ {cert, maps:get(certfile, Opts)}
|
|
ListenOpts = [ {cert, maps:get(certfile, Opts)}
|
|
|
, {key, maps:get(keyfile, Opts)}
|
|
, {key, maps:get(keyfile, Opts)}
|
|
|
, {alpn, ["mqtt"]}
|
|
, {alpn, ["mqtt"]}
|
|
|
- , {conn_acceptors, maps:get(acceptors, Opts, DefAcceptors)}
|
|
|
|
|
- , {idle_timeout_ms, emqx_config:get_zone_conf(zone(Opts),
|
|
|
|
|
- [mqtt, idle_timeout])}
|
|
|
|
|
|
|
+ , {conn_acceptors, lists:max([DefAcceptors, maps:get(acceptors, Opts, 0)])}
|
|
|
|
|
+ , {idle_timeout_ms, lists:max([
|
|
|
|
|
+ emqx_config:get_zone_conf(zone(Opts), [mqtt, idle_timeout]) * 3
|
|
|
|
|
+ , timer:seconds(maps:get(idle_timeout, Opts))]
|
|
|
|
|
+ )}
|
|
|
],
|
|
],
|
|
|
- ConnectionOpts = #{conn_callback => emqx_quic_connection
|
|
|
|
|
|
|
+ ConnectionOpts = #{ conn_callback => emqx_quic_connection
|
|
|
, peer_unidi_stream_count => 1
|
|
, peer_unidi_stream_count => 1
|
|
|
, peer_bidi_stream_count => 10
|
|
, peer_bidi_stream_count => 10
|
|
|
, zone => zone(Opts)
|
|
, zone => zone(Opts)
|
|
|
, listener => {quic, ListenerName}
|
|
, listener => {quic, ListenerName}
|
|
|
},
|
|
},
|
|
|
- StreamOpts = [],
|
|
|
|
|
|
|
+ StreamOpts = [{stream_callback, emqx_quic_stream}],
|
|
|
quicer:start_listener(listener_id(quic, ListenerName),
|
|
quicer:start_listener(listener_id(quic, ListenerName),
|
|
|
port(ListenOn), {ListenOpts, ConnectionOpts, StreamOpts});
|
|
port(ListenOn), {ListenOpts, ConnectionOpts, StreamOpts});
|
|
|
[] ->
|
|
[] ->
|