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()}.
|
-spec new_conn(quicer:connection_handler(), cb_state()) -> {ok, cb_state()} | {error, any()}.
|
||||||
new_conn(Conn, S) ->
|
new_conn(Conn, S) ->
|
||||||
case emqx_connection:start_link(emqx_quic_stream, Conn, S) of
|
process_flag(trap_exit, true),
|
||||||
{ok, _Pid} ->
|
case emqx_connection:start_link(emqx_quic_stream, {self(), Conn}, S) of
|
||||||
ok = quicer:async_handshake(Conn),
|
{ok, Pid} ->
|
||||||
{ok, S};
|
receive
|
||||||
|
{Pid, stream_acceptor_ready} ->
|
||||||
|
ok = quicer:async_handshake(Conn),
|
||||||
|
{ok, S};
|
||||||
|
{'EXIT', Pid, _Reason} ->
|
||||||
|
{error, stream_accept_error}
|
||||||
|
end;
|
||||||
Other ->
|
Other ->
|
||||||
{error, Other}
|
{error, Other}
|
||||||
end.
|
end.
|
||||||
|
|
|
@ -31,8 +31,16 @@
|
||||||
, peercert/1
|
, peercert/1
|
||||||
]).
|
]).
|
||||||
|
|
||||||
wait(Conn) ->
|
wait({ConnOwner, Conn}) ->
|
||||||
quicer:accept_stream(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(_) ->
|
type(_) ->
|
||||||
quic.
|
quic.
|
||||||
|
@ -44,6 +52,7 @@ sockname(S) ->
|
||||||
quicer:sockname(S).
|
quicer:sockname(S).
|
||||||
|
|
||||||
peercert(_S) ->
|
peercert(_S) ->
|
||||||
|
%% @todo but unsupported by msquic
|
||||||
nossl.
|
nossl.
|
||||||
|
|
||||||
getstat(Socket, Stats) ->
|
getstat(Socket, Stats) ->
|
||||||
|
|
Loading…
Reference in New Issue