summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Stoddard <stoddard@apache.org>1999-08-21 06:43:15 +0200
committerBill Stoddard <stoddard@apache.org>1999-08-21 06:43:15 +0200
commit77acd90f253994077b80cec604c2400ba757a9c8 (patch)
tree0f2666ee7b1700543a3ee43a064779a7cc121dbc
parentUse AcceptEx (a.k.a. accept and receive) on windows NT. Begin work to make (diff)
downloadapache2-77acd90f253994077b80cec604c2400ba757a9c8.tar.xz
apache2-77acd90f253994077b80cec604c2400ba757a9c8.zip
Forgot listen.c in the earlier AcceptEx patch to winnt.c.
Enable winnt mpm to detech OS at runtime. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83743 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--server/listen.c9
-rw-r--r--server/mpm/winnt/mpm_winnt.c36
2 files changed, 32 insertions, 13 deletions
diff --git a/server/listen.c b/server/listen.c
index 14624d6dac..5e73cc5090 100644
--- a/server/listen.c
+++ b/server/listen.c
@@ -78,11 +78,20 @@ static int make_sock(const struct sockaddr_in *server)
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) {
diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c
index 299675062b..1adf15002d 100644
--- a/server/mpm/winnt/mpm_winnt.c
+++ b/server/mpm/winnt/mpm_winnt.c
@@ -94,6 +94,8 @@ static char ap_coredump_dir[MAX_STRING_LEN];
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;
@@ -767,12 +769,12 @@ static void child_main(int child_num)
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;
@@ -954,10 +956,9 @@ static void worker_main()
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");
@@ -965,11 +966,17 @@ static void worker_main()
/* 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) {
@@ -1360,6 +1367,9 @@ static void winnt_pre_config(pool *pconf, pool *plog, pool *ptemp)
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) {