apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpl...@apache.org
Subject svn commit: r565517 - /apr/apr/branches/0.9.x/network_io/unix/sockets.c
Date Mon, 13 Aug 2007 21:02:09 GMT
Author: rpluem
Date: Mon Aug 13 14:02:07 2007
New Revision: 565517

URL: http://svn.apache.org/viewvc?view=rev&rev=565517
Log:
Revert r442526, r443265:

1. Comment taken from r473681
   (http://svn.apache.org/viewvc?view=rev&revision=473681):

   Making a new API guarantee (to have apr_socket_accept not allocate
   from the pool on error) can only be done in a minor version bump.

2. It breaks remote_addr handling (e.g. in httpd).


Modified:
    apr/apr/branches/0.9.x/network_io/unix/sockets.c

Modified: apr/apr/branches/0.9.x/network_io/unix/sockets.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/0.9.x/network_io/unix/sockets.c?view=diff&rev=565517&r1=565516&r2=565517
==============================================================================
--- apr/apr/branches/0.9.x/network_io/unix/sockets.c (original)
+++ apr/apr/branches/0.9.x/network_io/unix/sockets.c Mon Aug 13 14:02:07 2007
@@ -153,35 +153,27 @@
 apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock,
                                apr_pool_t *connection_context)
 {
-    int s;
-    apr_sockaddr_t sa;
+    alloc_socket(new, connection_context);
+    set_socket_vars(*new, sock->local_addr->sa.sin.sin_family, SOCK_STREAM, sock->protocol);
 
-    memset(&sa, 0, sizeof(apr_sockaddr_t));
-    apr_sockaddr_vars_set(&sa, sock->local_addr->sa.sin.sin_family, 0);
-    sa.pool = connection_context;
-    s = accept(sock->socketdes, (struct sockaddr *)&sa.sa, &sa.salen);
+#ifndef HAVE_POLL
+    (*new)->connected = 1;
+#endif
+    (*new)->timeout = -1;
+    
+    (*new)->socketdes = accept(sock->socketdes, 
+                               (struct sockaddr *)&(*new)->remote_addr->sa,
+                               &(*new)->remote_addr->salen);
 
-    if (s < 0) {
+    if ((*new)->socketdes < 0) {
         return errno;
     }
 #ifdef TPF
-    if (s == 0) { 
+    if ((*new)->socketdes == 0) { 
         /* 0 is an invalid socket for TPF */
         return APR_EINTR;
     }
 #endif
-    alloc_socket(new, connection_context);
-    set_socket_vars(*new, sock->local_addr->sa.sin.sin_family, SOCK_STREAM, sock->protocol);
-
-#ifndef HAVE_POLL
-    (*new)->connected = 1;
-#endif
-    (*new)->timeout = -1;
-
-    (*new)->remote_addr_unknown = 0;
-
-    (*new)->socketdes = s;
-    *(*new)->remote_addr = sa;
 
     *(*new)->local_addr = *sock->local_addr;
 



Mime
View raw message