Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msquic2.3.5 #278

Merged
merged 3 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ default: build-nif

.PHONY: build-nif
build-nif:
./build.sh 'v2.2.3'
./build.sh 'v2.3.5'

compile:
$(REBAR) compile
Expand Down
52 changes: 52 additions & 0 deletions c_src/quicer_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -2567,3 +2567,55 @@ parse_registration(ErlNifEnv *env,

return TRUE;
}

const char *
QuicStatusToString(_In_ QUIC_STATUS Status)
{
switch (Status)
{
case QUIC_STATUS_SUCCESS:
return "SUCCESS";
case QUIC_STATUS_PENDING:
return "PENDING";
case QUIC_STATUS_OUT_OF_MEMORY:
return "OUT_OF_MEMORY";
case QUIC_STATUS_INVALID_PARAMETER:
return "INVALID_PARAMETER";
case QUIC_STATUS_INVALID_STATE:
return "INVALID_STATE";
case QUIC_STATUS_NOT_SUPPORTED:
return "NOT_SUPPORTED";
case QUIC_STATUS_NOT_FOUND:
return "NOT_FOUND";
case QUIC_STATUS_BUFFER_TOO_SMALL:
return "BUFFER_TOO_SMALL";
case QUIC_STATUS_HANDSHAKE_FAILURE:
return "HANDSHAKE_FAILURE";
case QUIC_STATUS_ABORTED:
return "ABORTED";
case QUIC_STATUS_ADDRESS_IN_USE:
return "ADDRESS_IN_USE";
case QUIC_STATUS_CONNECTION_TIMEOUT:
return "CONNECTION_TIMEOUT";
case QUIC_STATUS_CONNECTION_IDLE:
return "CONNECTION_IDLE";
case QUIC_STATUS_UNREACHABLE:
return "UNREACHABLE";
case QUIC_STATUS_INTERNAL_ERROR:
return "INTERNAL_ERROR";
case QUIC_STATUS_CONNECTION_REFUSED:
return "CONNECTION_REFUSED";
case QUIC_STATUS_PROTOCOL_ERROR:
return "PROTOCOL_ERROR";
case QUIC_STATUS_VER_NEG_ERROR:
return "VER_NEG_ERROR";
case QUIC_STATUS_USER_CANCELED:
return "USER_CANCELED";
case QUIC_STATUS_ALPN_NEG_FAILURE:
return "ALPN_NEG_FAILURE";
case QUIC_STATUS_STREAM_LIMIT_REACHED:
return "STREAM_LIMIT_REACHED";
}

return "UNKNOWN";
}
2 changes: 2 additions & 0 deletions c_src/quicer_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,6 @@ ERL_NIF_TERM set_connection_opt(ErlNifEnv *env,
ERL_NIF_TERM optval,
ERL_NIF_TERM elevel);

const char *QuicStatusToString(_In_ QUIC_STATUS Status);

#endif // __QUICER_CONFIG_H_
2 changes: 0 additions & 2 deletions c_src/quicer_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ extern inline void
EncodeHexBuffer(uint8_t *Buffer, uint8_t BufferLen, char *HexString);
#endif

extern inline const char *QuicStatusToString(QUIC_STATUS Status);

static QUIC_STATUS
handle_connection_event_connected(QuicerConnCTX *c_ctx,
QUIC_CONNECTION_EVENT *Event);
Expand Down
29 changes: 29 additions & 0 deletions test/quicer_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
tc_stream_passive_receive_large_buffer_1/1,
tc_stream_passive_receive_large_buffer_2/1,
tc_stream_send_after_conn_close/1,
tc_stream_send_after_stream_shutdown/1,
tc_stream_send_after_async_conn_close/1,
tc_stream_sendrecv_large_data_passive/1,
%% @deprecated
Expand Down Expand Up @@ -737,6 +738,34 @@ tc_stream_send_after_conn_close(Config) ->
ct:fail("timeout")
end.

tc_stream_send_after_stream_shutdown(Config) ->
Port = select_port(),
Owner = self(),
{SPid, Ref} = spawn_monitor(fun() -> simple_stream_server(Owner, Config, Port) end),
receive
listener_ready -> ok
end,

{ok, Conn} = quicer:connect("localhost", Port, default_conn_opts(), 5000),
{ok, Stm} = quicer:start_stream(Conn, []),
{ok, 4} = quicer:send(Stm, <<"ping">>),
{ok, {_, _}} = quicer:sockname(Conn),

ok = quicer:async_shutdown_stream(Stm),
case quicer:send(Stm, <<"ping2">>) of
{error, closed} ->
ok;
{error, stm_send_error, aborted} ->
ok;
{error, stm_send_error, invalid_state} ->
ok;
{error, cancelled} ->
ok
end,
ok = quicer:close_connection(Conn),
SPid ! done,
ok = ensure_server_exit_normal(Ref).

tc_stream_send_after_async_conn_close(Config) ->
Port = select_port(),
Owner = self(),
Expand Down
2 changes: 1 addition & 1 deletion test/quicer_listener_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ tc_listener_conf_reload(Config) ->
quicer_test_lib:report_unhandled_messages(),
ct:fail("nothing from conn 2")
end,
gen_server:stop(ClientConnPid),
catch gen_server:stop(ClientConnPid),
quicer_listener:stop_listener(QuicApp).

tc_listener_conf_reload_listen_on(Config) ->
Expand Down
Loading