apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r473681 - /apr/apr/branches/1.2.x/network_io/unix/sockets.c
Date Sat, 11 Nov 2006 10:07:49 GMT
Author: jorton
Date: Sat Nov 11 02:07:48 2006
New Revision: 473681

URL: http://svn.apache.org/viewvc?view=rev&rev=473681
Log:
Revert r442492, r443263:

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.


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

Modified: apr/apr/branches/1.2.x/network_io/unix/sockets.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/network_io/unix/sockets.c?view=diff&rev=473681&r1=473680&r2=473681
==============================================================================
--- apr/apr/branches/1.2.x/network_io/unix/sockets.c (original)
+++ apr/apr/branches/1.2.x/network_io/unix/sockets.c Sat Nov 11 02:07:48 2006
@@ -176,35 +176,29 @@
 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