feat(quic): at least 8 x number of cores acceptors

This commit is contained in:
William Yang 2021-08-25 17:04:22 +02:00
parent eb7625a595
commit 1b5acdb9c5
2 changed files with 8 additions and 12 deletions

View File

@ -182,7 +182,7 @@ do_start_listener(quic, ListenerName, #{bind := ListenOn} = Opts) ->
ListenOpts = [ {cert, maps:get(certfile, Opts)}
, {key, maps:get(keyfile, Opts)}
, {alpn, ["mqtt"]}
, {conn_acceptors, maps:get(acceptors, Opts, DefAcceptors)}
, {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))]

View File

@ -35,17 +35,13 @@ init(ConnOpts) when is_map(ConnOpts) ->
-spec new_conn(quicer:connection_handler(), cb_state()) -> {ok, cb_state()} | {error, any()}.
new_conn(Conn, S) ->
process_flag(trap_exit, true),
case emqx_connection:start_link(emqx_quic_stream, {self(), Conn}, S) of
{ok, Pid} ->
{ok, Pid} = emqx_connection:start_link(emqx_quic_stream, {self(), Conn}, S),
receive
{Pid, stream_acceptor_ready} ->
ok = quicer:async_handshake(Conn),
{ok, S};
{'EXIT', Pid, _Reason} ->
{error, stream_accept_error}
end;
Other ->
{error, Other}
end.
-spec connected(quicer:connection_handler(), cb_state()) -> {ok, cb_state()} | {error, any()}.