Skip to content

Commit

Permalink
* test/testsock.c (test_get_addr): Fix test to portably switch
Browse files Browse the repository at this point in the history
  the socket to non-blocking mode using apr_socket_timeout_set().
  Also make the test SKIP for the case where the connect() completes
  synchronously.

Submitted by: ivan, jorton


git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1920070 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
notroj committed Aug 20, 2024
1 parent cd2f704 commit 7f0e57c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/testsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,17 +420,17 @@ static void test_get_addr(abts_case *tc, void *data)
APR_ASSERT_SUCCESS(tc, "create client socket", rv);

APR_ASSERT_SUCCESS(tc, "enable non-block mode",
apr_socket_opt_set(cd, APR_SO_NONBLOCK, 1));
apr_socket_timeout_set(cd, 0));

/* It is valid for a connect() on a socket with NONBLOCK set to
* succeed (if the connection can be established synchronously),
* but if it does, this test cannot proceed. */
/* It is valid for a connect() on a non-blocking socket to succeed
* (if the connection can be established synchronously), but if it
* does, this test cannot proceed. */
rv = apr_socket_connect(cd, sa);
if (rv == APR_SUCCESS) {
apr_socket_close(ld);
apr_socket_close(cd);
ABTS_NOT_IMPL(tc, "Cannot test if connect completes "
"synchronously");
ABTS_SKIP(tc, data, "Cannot test if connect() completes "
"synchronously");
return;
}

Expand Down

0 comments on commit 7f0e57c

Please sign in to comment.