httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: httpd-2.0/server/mpm/winnt mpm_winnt.c
Date Wed, 17 Apr 2002 16:39:12 GMT
wrowe       02/04/17 09:39:12

  Modified:    server/mpm/winnt mpm_winnt.c
  Log:
    Experimental patch that may mitigate (but not eliminate) the errors in
    [crit] (32538)An operation was attempted on something that is not a socket.
         : Parent: WSADuplicateSocket failed for socket ...
    if the particular stacks' bug is that it won't associate a handle as a
    socket if that handle was duped with DuplicateHandle().  Other bugs with
    unimplemented WSADuplicateSocket are not addressed by this patch.
  
  Revision  Changes    Path
  1.265     +24 -7     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.264
  retrieving revision 1.265
  diff -u -r1.264 -r1.265
  --- mpm_winnt.c	17 Apr 2002 16:36:28 -0000	1.264
  +++ mpm_winnt.c	17 Apr 2002 16:39:12 -0000	1.265
  @@ -527,15 +527,32 @@
   
       for (lr = ap_listeners; lr; lr = lr->next) {
           apr_os_sock_get(&nsd,lr->sd);
  -        if (!DuplicateHandle(hProcess, (HANDLE) nsd, hProcess, &dup, 
  -                             0, FALSE, DUPLICATE_SAME_ACCESS)) {
  -            ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_os_error(), ap_server_conf,
  -                         "set_listeners_noninheritable: DuplicateHandle failed.");
  +        if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
  +            if (!DuplicateHandle(hProcess, (HANDLE) nsd, hProcess, &dup, 
  +                                 0, FALSE, DUPLICATE_SAME_ACCESS)) {
  +                ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_os_error(), ap_server_conf,
  +                             "set_listeners_noninheritable: DuplicateHandle failed.");
  +            }
  +            else {
  +                closesocket(nsd);
  +                nsd = (SOCKET) dup;
  +                apr_os_sock_put(&lr->sd, &nsd, p);
  +            }
           }
           else {
  -            closesocket(nsd);
  -            nsd = (SOCKET) dup;
  -            apr_os_sock_put(&lr->sd, &nsd, p);
  +            /* A different approach.  Many users report errors such as 
  +             * (32538)An operation was attempted on something that is not 
  +             * a socket.  : Parent: WSADuplicateSocket failed...
  +             *
  +             * This appears that the duplicated handle is no longer recognized
  +             * as a socket handle.  SetHandleInformation should overcome that
  +             * problem by not altering the handle identifier.  But this won't
  +             * work on 9x - it's unsupported.
  +             */
  +            if (!SetHandleInformation(nsd, HANDLE_FLAG_INHERIT, 0)) {
  +                ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_os_error(), ap_server_conf,
  +                             "set_listeners_noninheritable: SetHandleInformation failed.");
  +            }
           }
       }
   
  
  
  

Mime
View raw message