httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stodd...@apache.org
Subject cvs commit: httpd-2.0/server/mpm/winnt mpm_winnt.c
Date Tue, 20 Nov 2001 19:03:21 GMT
stoddard    01/11/20 11:03:21

  Modified:    server/mpm/winnt mpm_winnt.c
  Log:
  Win32 bug fix:
  Move call to setsockopt(SO_UPDATE_ACCEPT_CONTEXT) (to cause the accept socket
  to inherit the listener attributes) to after a connection has been accepted.
  This piece of code prior to this fix was just wrong; not sure why I never
  saw warning messages on NT or 2000.
  
  Revision  Changes    Path
  1.196     +10 -10    httpd-2.0/server/mpm/winnt/mpm_winnt.c
  
  Index: mpm_winnt.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/mpm_winnt.c,v
  retrieving revision 1.195
  retrieving revision 1.196
  diff -u -r1.195 -r1.196
  --- mpm_winnt.c	2001/11/17 07:54:34	1.195
  +++ mpm_winnt.c	2001/11/20 19:03:21	1.196
  @@ -719,7 +719,6 @@
               continue;
           }
   
  -
       again:            
           /* Create and initialize the accept socket */
           if (pCompContext->accept_socket == INVALID_SOCKET) {
  @@ -730,15 +729,6 @@
                                "winnt_accept: socket() failed. Process will exit.");
                   // return -1;
               }
  -
  -            /* SO_UPDATE_ACCEPT_CONTEXT is required for shutdown() to work */
  -            if (setsockopt(pCompContext->accept_socket, SOL_SOCKET,
  -                           SO_UPDATE_ACCEPT_CONTEXT, (char *)&nlsd,
  -                           sizeof(nlsd))) {
  -                ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_netos_error(), ap_server_conf,
  -                             "setsockopt(SO_UPDATE_ACCEPT_CONTEXT) failed.");
  -                /* Not a failure condition. Keep running. */
  -            }
           }
   
           /* AcceptEx on the completion context. The completion context will be 
  @@ -775,6 +765,16 @@
               WaitForSingleObject(pCompContext->Overlapped.hEvent, INFINITE);
           }
   
  +        /* Inherit the listen socket settings. Required for 
  +         * shutdown() to work 
  +         */
  +        if (setsockopt(pCompContext->accept_socket, SOL_SOCKET,
  +                       SO_UPDATE_ACCEPT_CONTEXT, (char *)&nlsd,
  +                       sizeof(nlsd))) {
  +            ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_netos_error(), ap_server_conf,
  +                         "setsockopt(SO_UPDATE_ACCEPT_CONTEXT) failed.");
  +            /* Not a failure condition. Keep running. */
  +        }
           /* When a connection is received, send an io completion notification to
            * the ThreadDispatchIOCP. This function could be replaced by
            * mpm_post_completion_context(), but why do an extra function call...
  
  
  

Mime
View raw message