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: fix s2n_io_pair_close_one_end #4841

Merged
merged 3 commits into from
Oct 15, 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
6 changes: 4 additions & 2 deletions tests/testlib/s2n_connection_test_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,12 @@ int s2n_io_pair_close(struct s2n_test_io_pair *io_pair)

int s2n_io_pair_close_one_end(struct s2n_test_io_pair *io_pair, int mode_to_close)
{
if (mode_to_close == S2N_CLIENT) {
if (mode_to_close == S2N_CLIENT && io_pair->client != S2N_CLOSED_FD) {
POSIX_GUARD(close(io_pair->client));
} else if (mode_to_close == S2N_SERVER) {
io_pair->client = S2N_CLOSED_FD;
} else if (mode_to_close == S2N_SERVER && io_pair->server != S2N_CLOSED_FD) {
POSIX_GUARD(close(io_pair->server));
io_pair->server = S2N_CLOSED_FD;
}
return 0;
}
Expand Down
2 changes: 2 additions & 0 deletions tests/testlib/s2n_testlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include "stuffer/s2n_stuffer.h"
#include "tls/s2n_connection.h"

#define S2N_CLOSED_FD -1

extern const struct s2n_ecc_preferences ecc_preferences_for_retry;
extern const struct s2n_security_policy security_policy_test_tls13_retry;

Expand Down
Loading