httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject [patch] not my code, just my itch
Date Wed, 29 Nov 2000 18:17:40 GMT
I want to rip out apr_canonical_error today.  This patch allows us
to do so, but it isn't win32 so I'll let others comment.

Note that apr_errno.h is modified to handle these errors, and add
the EPROTO condition to APR_STATUS_IS_ECONNABORTED, since that's the
appropriate hack.

Is the patch acceptable?


Index: modules/mpm/spmt_os2/spmt_os2.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/mpm/spmt_os2/spmt_os2.c,v
retrieving revision 1.65
diff -u -r1.65 spmt_os2.c
--- modules/mpm/spmt_os2/spmt_os2.c 2000/11/09 00:37:06 1.65
+++ modules/mpm/spmt_os2/spmt_os2.c 2000/11/29 16:49:30
@@ -871,9 +871,14 @@
             THREAD_GLOBAL(usr1_just_die) = 0;
             rv = apr_accept(&csd, sd, ptrans);
 
-     if (rv == APR_SUCCESS)
+            if (APR_STATUS_IS_SUCCESS(rv)) {
   break;  /* We have a socket ready for reading */
-     else {
+            }
+            else if (APR_STATUS_IS_ECONNABORTED(rv) 
+                  || APR_STATUS_IS_ECONNRESET(rv)
+                  || APR_STATUS_IS_ETIMEDOUT(rv)
+                  || APR_STATUS_IS_EHOSTUNREACH(rv)
+                  || APR_STATUS_IS_ENETUNREACH(rv)) {
 
   /* Our old behaviour here was to continue after accept()
    * errors.  But this leads us into lots of troubles
@@ -885,58 +890,27 @@
    * lead to never-ending loops here.  So it seems best
    * to just exit in most cases.
    */
-                switch (apr_canonical_error(rv)) {
-#ifdef EPROTO
-      /* EPROTO on certain older kernels really means
-       * ECONNABORTED, so we need to ignore it for them.
-       * See discussion in new-httpd archives nh.9701
-       * search for EPROTO.
-       *
-       * Also see nh.9603, search for EPROTO:
-       * There is potentially a bug in Solaris 2.x x<6,
-       * and other boxes that implement tcp sockets in
-       * userland (i.e. on top of STREAMS).  On these
-       * systems, EPROTO can actually result in a fatal
-       * loop.  See PR#981 for example.  It's hard to
-       * handle both uses of EPROTO.
-       */
-                case EPROTO:
-#endif
-#ifdef ECONNABORTED
-                case ECONNABORTED:
-#endif
-      /* Linux generates the rest of these, other tcp
-       * stacks (i.e. bsd) tend to hide them behind
-       * getsockopt() interfaces.  They occur when
-       * the net goes sour or the client disconnects
-       * after the three-way handshake has been done
-       * in the kernel but before userland has picked
-       * up the socket.
-       */
-#ifdef ECONNRESET
-                case ECONNRESET:
-#endif
-#ifdef ETIMEDOUT
-                case ETIMEDOUT:
-#endif
-#ifdef EHOSTUNREACH
-  case EHOSTUNREACH:
-#endif
-#ifdef ENETUNREACH
-  case ENETUNREACH:
-#endif
-                    break;
 
-                case EINTR:
-                    /* We only get hit by an EINTR if the parent is
-                     * killing us off
-                     */
-                    clean_child_exit(0);
-  default:
-      ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf,
-    "accept: (client socket)");
-      clean_child_exit(1);
-  }
+                /* Linux generates most of these, other tcp
+   * stacks (i.e. bsd) tend to hide them behind
+   * getsockopt() interfaces.  They occur when
+   * the net goes sour or the client disconnects
+   * after the three-way handshake has been done
+   * in the kernel but before userland has picked
+   * up the socket.
+   */
+                break;
+            }
+            else if (APR_STATUS_IS_EINTR(rv)) {
+                /* We only get hit by an EINTR if the parent is
+                 * killing us off
+                 */
+                clean_child_exit(0);
+            }
+            else {
+  ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf,
+       "accept: (client socket)");
+  clean_child_exit(1);
      }
 
      if (ap_stop_signalled()) {



Mime
View raw message