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

Fix/william/inval handshake handle #270

Merged
merged 2 commits into from
May 6, 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
18 changes: 11 additions & 7 deletions c_src/quicer_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1115,13 +1115,10 @@ continue_connection_handshake(QuicerConnCTX *c_ctx)
}

// Apply connection owners' option overrides
if (QUIC_FAILED(Status = MsQuic->SetParam(c_ctx->Connection,
QUIC_PARAM_CONN_SETTINGS,
sizeof(QUIC_SETTINGS),
&c_ctx->owner->Settings)))
{
return Status;
}
Status = MsQuic->SetParam(c_ctx->Connection,
QUIC_PARAM_CONN_SETTINGS,
sizeof(QUIC_SETTINGS),
&c_ctx->owner->Settings);
return Status;
}

Expand All @@ -1141,10 +1138,17 @@ async_handshake_1(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])

TP_NIF_3(start, (uintptr_t)c_ctx->Connection, 0);

if (!get_conn_handle(c_ctx))
{
return ERROR_TUPLE_2(ATOM_CLOSED);
}

if (QUIC_FAILED(Status = continue_connection_handshake(c_ctx)))
{
res = ERROR_TUPLE_2(ATOM_STATUS(Status));
}

put_conn_handle(c_ctx);
return res;
}

Expand Down
4 changes: 3 additions & 1 deletion test/quicer_connection_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,9 @@ simple_slow_conn_server(Owner, Config, Port, HandshakeDelay) ->
ok
end,
%% test what happens if handshake twice
{error, invalid_state} = quicer:handshake(Conn),
?assertMatch(
{error, Err} when Err == closed orelse Err == invalid_state, quicer:handshake(Conn)
),
receive
done ->
quicer:close_listener(L),
Expand Down
Loading