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;
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 {
* 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,
}
/* 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);
}
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);
}
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;
}
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 }
};
*/
/* Initialize shared static objects.
+ * TODO: Put config related statics into an sconf structure.
*/
pconf = pconf_;
#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));