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 child.c mpm_winnt.c mpm_winnt.h
Date Mon, 15 Dec 2003 23:19:15 GMT
stoddard    2003/12/15 15:19:14

  Modified:    server/mpm/winnt child.c mpm_winnt.c mpm_winnt.h
  Log:
  Win32: Rename WindowsSocketsWorkaround directive to Win32DisableAcceptEx.
  Clean up code paths.
  
  Revision  Changes    Path
  1.20      +8 -7      httpd-2.0/server/mpm/winnt/child.c
  
  Index: child.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/child.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- child.c	15 Dec 2003 12:38:50 -0000	1.19
  +++ child.c	15 Dec 2003 23:19:14 -0000	1.20
  @@ -735,12 +735,13 @@
           ap_update_child_status_from_indexes(0, thread_num, SERVER_READY, NULL);
   
           /* Grab a connection off the network */
  -        if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS || windows_sockets_workaround
== 1) {
  -            context = win9x_get_connection(context);
  +        if (use_acceptex) {
  +            context = winnt_get_connection(context);
           }
           else {
  -            context = winnt_get_connection(context);
  +            context = win9x_get_connection(context);
           }
  +        
           if (!context) {
               /* Time for the thread to exit */
               break;
  @@ -803,7 +804,7 @@
   static void create_listener_thread()
   {
       int tid;
  -    if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS || windows_sockets_workaround
== 1) {
  +    if (!use_acceptex) {
           _beginthreadex(NULL, 0, (LPTHREAD_START_ROUTINE) win9x_accept,
                          NULL, 0, &tid);
       } else {
  @@ -874,7 +875,7 @@
        * Create the worker thread dispatch IOCompletionPort
        * on Windows NT/2000
        */
  -    if (osver.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS && windows_sockets_workaround
!= 1) {
  +    if (use_acceptex) {
           /* Create the worker thread dispatch IOCP */
           ThreadDispatchIOCP = CreateIoCompletionPort(INVALID_HANDLE_VALUE,
                                                       NULL,
  @@ -1041,7 +1042,7 @@
       }
   
       /* Shutdown the worker threads */
  -    if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS || windows_sockets_workaround
== 1) {
  +    if (!use_acceptex) {
           for (i = 0; i < threads_created; i++) {
               add_job(INVALID_SOCKET);
           }
  @@ -1099,7 +1100,7 @@
   
       CloseHandle(allowed_globals.jobsemaphore);
       apr_thread_mutex_destroy(allowed_globals.jobmutex);
  -    if (osver.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS && windows_sockets_workaround
!= 1) {
  +    if (use_acceptex) {
       	apr_thread_mutex_destroy(qlock);
           CloseHandle(qwait_event);
       }
  
  
  
  1.302     +19 -12    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.301
  retrieving revision 1.302
  diff -u -r1.301 -r1.302
  --- mpm_winnt.c	3 Sep 2003 19:27:11 -0000	1.301
  +++ mpm_winnt.c	15 Dec 2003 23:19:14 -0000	1.302
  @@ -102,8 +102,8 @@
   static DWORD parent_pid;
   DWORD my_pid;
   
  -int windows_sockets_workaround = 0;
   int ap_threads_per_child = 0;
  +int use_acceptex = 1;
   static int thread_limit = DEFAULT_THREAD_LIMIT;
   static int first_thread_limit = 0;
   static int changed_limit_at_restart;
  @@ -218,33 +218,34 @@
       }
       return NULL;
   }
  -static const char *set_sockets_workaround (cmd_parms *cmd, void *dummy, char *arg) 
  +static const char *set_disable_acceptex(cmd_parms *cmd, void *dummy, char *arg) 
   {
       const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
       if (err != NULL) {
           return err;
       }
  -
  -    windows_sockets_workaround = 0;
  -    if (!strcasecmp(arg, "on")) {
  -        windows_sockets_workaround = 1;
  -    }
  -    else if (strcasecmp(arg, "off")) {
  +    if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
           ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
  -                         "WARNING: setting WindowsSocketsWorkaround to off");
  +                     "Ignoring Win32EnableAcceptEx configuration directive. "
  +                     "The directive is not valid on Windows 9x");
  +        return NULL;
       }
  +
  +    use_acceptex = 0;
  +
  +    ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
  +                         "Disabled use AcceptEx WinSock2 API");
       return NULL;
   }
   
  -
   static const command_rec winnt_cmds[] = {
   LISTEN_COMMANDS,
   AP_INIT_TAKE1("ThreadsPerChild", set_threads_per_child, NULL, RSRC_CONF,
     "Number of threads each child creates" ),
   AP_INIT_TAKE1("ThreadLimit", set_thread_limit, NULL, RSRC_CONF,
     "Maximum worker threads in a server for this run of Apache"),
  -AP_INIT_TAKE1("WindowsSocketsWorkaround", set_sockets_workaround, NULL, RSRC_CONF,
  -  "Set \"on\" to work around buggy Winsock provider implementations of certain VPN or Firewall
software"),
  +AP_INIT_NO_ARGS("Win32DisableAcceptEx", set_disable_acceptex, NULL, RSRC_CONF,
  +  "Disable use of the high performance AcceptEx WinSock2 API to work around buggy VPN or
Firewall software"),
   
   { NULL }
   };
  @@ -1388,6 +1389,7 @@
        */
   
       /* Initialize shared static objects. 
  +     * TODO: Put config related statics into an sconf structure.
        */
       pconf = pconf_;
   
  @@ -1411,6 +1413,11 @@
   #ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
   	ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
   #endif
  +    /* use_acceptex which is enabled by default is not available on Win9x.
  +     */
  +    if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
  +        use_acceptex = 0;
  +    }
   
       apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
   
  
  
  
  1.43      +1 -1      httpd-2.0/server/mpm/winnt/mpm_winnt.h
  
  Index: mpm_winnt.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/mpm_winnt.h,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- mpm_winnt.h	4 Mar 2003 22:15:51 -0000	1.42
  +++ mpm_winnt.h	15 Dec 2003 23:19:14 -0000	1.43
  @@ -101,7 +101,7 @@
   
   /* From winnt.c: */
   
  -extern int windows_sockets_workaround;
  +extern int use_acceptex;
   extern OSVERSIONINFO osver;
   extern void clean_child_exit(int);
   
  
  
  

Mime
View raw message