feat(olp): quic
This commit is contained in:
parent
9304e3c122
commit
eb895a9f80
|
@ -35,6 +35,8 @@ 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_olp:is_overloaded() of
|
||||||
|
false ->
|
||||||
{ok, Pid} = emqx_connection:start_link(emqx_quic_stream, {self(), Conn}, S),
|
{ok, Pid} = emqx_connection:start_link(emqx_quic_stream, {self(), Conn}, S),
|
||||||
receive
|
receive
|
||||||
{Pid, stream_acceptor_ready} ->
|
{Pid, stream_acceptor_ready} ->
|
||||||
|
@ -42,6 +44,9 @@ new_conn(Conn, S) ->
|
||||||
{ok, S};
|
{ok, S};
|
||||||
{'EXIT', Pid, _Reason} ->
|
{'EXIT', Pid, _Reason} ->
|
||||||
{error, stream_accept_error}
|
{error, stream_accept_error}
|
||||||
|
end;
|
||||||
|
true ->
|
||||||
|
{error, overloaded}
|
||||||
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