else
ap_snprintf(addr, sizeof(addr), "port %d", ntohs(server->sin_port));
+#ifdef WIN32
+ s = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, WSA_FLAG_OVERLAPPED);
+ if (s == INVALID_SOCKET) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, NULL,
+ "make_sock: failed to get a socket for %s", addr);
+ return -1;
+ }
+#else
if ((s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
ap_log_error(APLOG_MARK, APLOG_CRIT, NULL,
"make_sock: failed to get a socket for %s", addr);
return -1;
}
+#endif
#ifdef SO_REUSEADDR
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *) &one, sizeof(int)) < 0) {
static server_rec *server_conf;
static int one_process = 0;
+
+static OSVERSIONINFO osver; /* VER_PLATFORM_WIN32_NT */
event *exit_event;
mutex *start_mutex;
int my_pid;
ap_clear_pool(lpCompContext->ptrans);
lpCompContext->conn_io = ap_bcreate(lpCompContext->ptrans, B_RDWR);
+ /* Grab a connection off the network */
+ if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT)
+ lpCompContext = winnt_get_connection(lpCompContext);
+ else
+ lpCompContext = win9x_get_connection(lpCompContext);
-#ifdef QUEUED_ACCEPT
- lpCompContext = win9x_get_connection(lpCompContext);
-#else
- lpCompContext = winnt_get_connection(lpCompContext);
-#endif
if (!lpCompContext)
break;
child_handles[i] = create_thread((void (*)(void *)) child_main, (void *) i);
}
-#ifdef QUEUED_ACCEPT
- /* spawn off accept thread */
- create_thread((void (*)(void *)) accept_and_queue_connections, (void *) NULL);
-#endif
+ /* spawn off accept thread (WIN9x only) */
+ if (osver.dwPlatformId != VER_PLATFORM_WIN32_NT)
+ create_thread((void (*)(void *)) accept_and_queue_connections, (void *) NULL);
rv = WaitForSingleObject(exit_event, INFINITE);
printf("exit event signalled \n");
/* Get ready to shutdown and exit */
ap_release_mutex(start_mutex);
-#ifdef QUEUED_ACCEPT
- for (i = 0; i < nthreads; i++) {
- add_job(-1);
+
+ if (osver.dwPlatformId != VER_PLATFORM_WIN32_NT) {
+ /* This is only needed for platforms that use the accept queue code
+ * (WIN9x only). It should work on NT but not as efficiently as the
+ * code written specifically for Windows NT.
+ */
+ for (i = 0; i < nthreads; i++) {
+ add_job(-1);
+ }
}
-#endif
+
/* Wait for all your children */
end_time = time(NULL) + 180;
while (nthreads) {
char *pid;
one_process=1;//!!getenv("ONE_PROCESS");
+ osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&osver);
+
/* AP_PARENT_PID is only valid in the child */
pid = getenv("AP_PARENT_PID");
if (pid) {