Skip to content

Commit

Permalink
Partially fix connection_setup_shutdown test (#28)
Browse files Browse the repository at this point in the history
Fix some race-conditions in test, but leave it commented out.
There are still server-bootstrap shutdown issues that appear regularly in x86 builds.
  • Loading branch information
graebm committed Apr 4, 2019
1 parent 549aff6 commit 3c0cbee
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/test_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ static void s_tester_on_server_connection_shutdown(
(void)connection;
(void)error_code;
struct tester *tester = user_data;
AWS_FATAL_ASSERT(aws_mutex_lock(&tester->wait_lock) == AWS_OP_SUCCESS);

tester->server_connection_is_shutdown = true;

AWS_FATAL_ASSERT(aws_mutex_unlock(&tester->wait_lock) == AWS_OP_SUCCESS);
aws_condition_variable_notify_one(&tester->wait_cvar);
}

Expand All @@ -94,6 +97,7 @@ static void s_tester_on_server_connection_setup(

(void)server;
struct tester *tester = user_data;
AWS_FATAL_ASSERT(aws_mutex_lock(&tester->wait_lock) == AWS_OP_SUCCESS);

if (error_code) {
tester->wait_result = error_code;
Expand All @@ -113,6 +117,7 @@ static void s_tester_on_server_connection_setup(

tester->server_connection = connection;
done:
AWS_FATAL_ASSERT(aws_mutex_unlock(&tester->wait_lock) == AWS_OP_SUCCESS);
aws_condition_variable_notify_one(&tester->wait_cvar);
}

Expand All @@ -122,13 +127,16 @@ static void s_tester_on_client_connection_setup(
void *user_data) {

struct tester *tester = user_data;
AWS_FATAL_ASSERT(aws_mutex_lock(&tester->wait_lock) == AWS_OP_SUCCESS);

if (error_code) {
tester->wait_result = error_code;
goto done;
}

tester->client_connection = connection;
done:
AWS_FATAL_ASSERT(aws_mutex_unlock(&tester->wait_lock) == AWS_OP_SUCCESS);
aws_condition_variable_notify_one(&tester->wait_cvar);
}

Expand All @@ -140,8 +148,11 @@ static void s_tester_on_client_connection_shutdown(
(void)connection;
(void)error_code;
struct tester *tester = user_data;
AWS_FATAL_ASSERT(aws_mutex_lock(&tester->wait_lock) == AWS_OP_SUCCESS);

tester->client_connection_is_shutdown = true;

AWS_FATAL_ASSERT(aws_mutex_unlock(&tester->wait_lock) == AWS_OP_SUCCESS);
aws_condition_variable_notify_one(&tester->wait_cvar);
}

Expand Down

0 comments on commit 3c0cbee

Please sign in to comment.