svn commit: r1924684 - in /apr/apr/branches/1.7.x: ./ CHANGES test/testsock.c

[email protected]
Newsgroups gmane.comp.apache.apr.cvs
Message-ID <[email protected]>
Author: minfrin
Date: Fri Mar 28 15:58:22 2025
New Revision: 1924684

URL: http://svn.apache.org/viewvc?rev=1924684&view=rev
Log:
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.


Modified:
    apr/apr/branches/1.7.x/   (props changed)
    apr/apr/branches/1.7.x/CHANGES
    apr/apr/branches/1.7.x/test/testsock.c

Propchange: apr/apr/branches/1.7.x/
------------------------------------------------------------------------------
  Merged /apr/apr/trunk:r1920070

Modified: apr/apr/branches/1.7.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.7.x/CHANGES?rev=1924684&r1=1924683&r2=1924684&view=diff
==============================================================================
--- apr/apr/branches/1.7.x/CHANGES [utf-8] (original)
+++ apr/apr/branches/1.7.x/CHANGES [utf-8] Fri Mar 28 15:58:22 2025
@@ -1,6 +1,11 @@
                                                      -*- coding: utf-8 -*-
 Changes for APR 1.7.6
 
+  *) 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. [Ivan Zhakov]
+
   *) network_io/win32/sockets.c: (apr_socket_connect): Copy the remote
      address by value rather than by reference.  This ensures that the
      sockaddr object returned by apr_socket_addr_get is allocated from

Modified: apr/apr/branches/1.7.x/test/testsock.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.7.x/test/testsock.c?rev=1924684&r1=1924683&r2=1924684&view=diff
==============================================================================
--- apr/apr/branches/1.7.x/test/testsock.c (original)
+++ apr/apr/branches/1.7.x/test/testsock.c Fri Mar 28 15:58:22 2025
@@ -420,17 +420,17 @@ static void test_get_addr(abts_case *tc,
     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;
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.