feat(quic): at least 8 x number of cores acceptors
This commit is contained in:
parent
eb7625a595
commit
1b5acdb9c5
|
@ -182,7 +182,7 @@ do_start_listener(quic, ListenerName, #{bind := ListenOn} = Opts) ->
|
||||||
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)}
|
, {conn_acceptors, lists:max([DefAcceptors, maps:get(acceptors, Opts, 0)])}
|
||||||
, {idle_timeout_ms, lists:max([
|
, {idle_timeout_ms, lists:max([
|
||||||
emqx_config:get_zone_conf(zone(Opts), [mqtt, idle_timeout]) * 3
|
emqx_config:get_zone_conf(zone(Opts), [mqtt, idle_timeout]) * 3
|
||||||
, timer:seconds(maps:get(idle_timeout, Opts))]
|
, timer:seconds(maps:get(idle_timeout, Opts))]
|
||||||
|
|
|
@ -35,17 +35,13 @@ init(ConnOpts) when is_map(ConnOpts) ->
|
||||||
-spec new_conn(quicer:connection_handler(), cb_state()) -> {ok, cb_state()} | {error, any()}.
|
-spec new_conn(quicer:connection_handler(), cb_state()) -> {ok, cb_state()} | {error, any()}.
|
||||||
new_conn(Conn, S) ->
|
new_conn(Conn, S) ->
|
||||||
process_flag(trap_exit, true),
|
process_flag(trap_exit, true),
|
||||||
case emqx_connection:start_link(emqx_quic_stream, {self(), Conn}, S) of
|
{ok, Pid} = emqx_connection:start_link(emqx_quic_stream, {self(), Conn}, S),
|
||||||
{ok, Pid} ->
|
receive
|
||||||
receive
|
{Pid, stream_acceptor_ready} ->
|
||||||
{Pid, stream_acceptor_ready} ->
|
ok = quicer:async_handshake(Conn),
|
||||||
ok = quicer:async_handshake(Conn),
|
{ok, S};
|
||||||
{ok, S};
|
{'EXIT', Pid, _Reason} ->
|
||||||
{'EXIT', Pid, _Reason} ->
|
{error, stream_accept_error}
|
||||||
{error, stream_accept_error}
|
|
||||||
end;
|
|
||||||
Other ->
|
|
||||||
{error, Other}
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec connected(quicer:connection_handler(), cb_state()) -> {ok, cb_state()} | {error, any()}.
|
-spec connected(quicer:connection_handler(), cb_state()) -> {ok, cb_state()} | {error, any()}.
|
||||||
|
|
Loading…
Reference in New Issue