Skip to content

Commit df2a7c7

Browse files
committed
Backport r1920070.
* test/testsock.c (test_get_addr): Fix test to portably switch the socket to non-blocking mode using apr_socket_timeout_set(). Also make the test SKIP for the case where the connect() completes synchronously. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1924684 13f79535-47bb-0310-9956-ffa450edef68
1 parent cb77e24 commit df2a7c7

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Diff for: CHANGES

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
-*- coding: utf-8 -*-
22
Changes for APR 1.7.6
33

4+
*) test/testsock.c (test_get_addr): Fix test to portably switch
5+
the socket to non-blocking mode using apr_socket_timeout_set().
6+
Also make the test SKIP for the case where the connect() completes
7+
synchronously. [Ivan Zhakov]
8+
49
*) network_io/win32/sockets.c: (apr_socket_connect): Copy the remote
510
address by value rather than by reference. This ensures that the
611
sockaddr object returned by apr_socket_addr_get is allocated from

Diff for: test/testsock.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -420,17 +420,17 @@ static void test_get_addr(abts_case *tc, void *data)
420420
APR_ASSERT_SUCCESS(tc, "create client socket", rv);
421421

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

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

0 commit comments

Comments
 (0)