]> granicus.if.org Git - apache/commitdiff
Win32: Rename WindowsSocketsWorkaround directive to Win32DisableAcceptEx.
authorBill Stoddard <stoddard@apache.org>
Mon, 15 Dec 2003 23:19:14 +0000 (23:19 +0000)
committerBill Stoddard <stoddard@apache.org>
Mon, 15 Dec 2003 23:19:14 +0000 (23:19 +0000)
Clean up code paths.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102071 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/winnt/child.c
server/mpm/winnt/mpm_winnt.c
server/mpm/winnt/mpm_winnt.h

index e1628167bbcd55c3cd8534b12e8fd6a1784003b9..72a66254f58e1d8fe10b6736881a9e4d97f5503b 100644 (file)
@@ -735,12 +735,13 @@ static void worker_main(long thread_num)
         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 cleanup_thread(HANDLE *handles, int *thread_cnt, int thread_to_clean
 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 @@ void child_main(apr_pool_t *pconf)
      * 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 @@ void child_main(apr_pool_t *pconf)
     }
 
     /* 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 @@ void child_main(apr_pool_t *pconf)
 
     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);
     }
index fb0d290527adff51117a41bb992f748fed2ee5c6..6b095d73998e7eafedffb162730e60be8786fce1 100644 (file)
@@ -102,8 +102,8 @@ OSVERSIONINFO osver; /* VER_PLATFORM_WIN32_NT */
 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 @@ static const char *set_thread_limit (cmd_parms *cmd, void *dummy, const char *ar
     }
     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 @@ static int winnt_pre_config(apr_pool_t *pconf_, apr_pool_t *plog, apr_pool_t *pt
      */
 
     /* Initialize shared static objects. 
+     * TODO: Put config related statics into an sconf structure.
      */
     pconf = pconf_;
 
@@ -1411,6 +1413,11 @@ static int winnt_pre_config(apr_pool_t *pconf_, apr_pool_t *plog, apr_pool_t *pt
 #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));
 
index 79d72c8b01e528e81cab2028c9d50f21791300ee..d615943bc951a06b3a612e092907d669fab62622 100644 (file)
@@ -101,7 +101,7 @@ void mpm_nt_eventlog_stderr_flush(void);
 
 /* From winnt.c: */
 
-extern int windows_sockets_workaround;
+extern int use_acceptex;
 extern OSVERSIONINFO osver;
 extern void clean_child_exit(int);