feat(quic): adapt to quicer 0.0.8
This commit is contained in:
parent
abd58bb235
commit
2ef2acc850
|
@ -34,10 +34,16 @@ init(ConnOpts) when is_map(ConnOpts) ->
|
|||
|
||||
-spec new_conn(quicer:connection_handler(), cb_state()) -> {ok, cb_state()} | {error, any()}.
|
||||
new_conn(Conn, S) ->
|
||||
case emqx_connection:start_link(emqx_quic_stream, Conn, S) of
|
||||
{ok, _Pid} ->
|
||||
process_flag(trap_exit, true),
|
||||
case emqx_connection:start_link(emqx_quic_stream, {self(), Conn}, S) of
|
||||
{ok, Pid} ->
|
||||
receive
|
||||
{Pid, stream_acceptor_ready} ->
|
||||
ok = quicer:async_handshake(Conn),
|
||||
{ok, S};
|
||||
{'EXIT', Pid, _Reason} ->
|
||||
{error, stream_accept_error}
|
||||
end;
|
||||
Other ->
|
||||
{error, Other}
|
||||
end.
|
||||
|
|
|
@ -31,8 +31,16 @@
|
|||
, peercert/1
|
||||
]).
|
||||
|
||||
wait(Conn) ->
|
||||
quicer:accept_stream(Conn, []).
|
||||
wait({ConnOwner, Conn}) ->
|
||||
{ok, Conn} = quicer:async_accept_stream(Conn, []),
|
||||
ConnOwner ! {self(), stream_acceptor_ready},
|
||||
receive
|
||||
%% from msquic
|
||||
{quic, new_stream, Stream} ->
|
||||
{ok, Stream};
|
||||
{'EXIT', ConnOwner, _Reason} ->
|
||||
{error, enotconn}
|
||||
end.
|
||||
|
||||
type(_) ->
|
||||
quic.
|
||||
|
@ -44,6 +52,7 @@ sockname(S) ->
|
|||
quicer:sockname(S).
|
||||
|
||||
peercert(_S) ->
|
||||
%% @todo but unsupported by msquic
|
||||
nossl.
|
||||
|
||||
getstat(Socket, Stats) ->
|
||||
|
|
Loading…
Reference in New Issue