httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stodd...@hyperreal.org
Subject cvs commit: apache-2.0/mpm/src/modules/mpm/winnt winnt.c
Date Sat, 21 Aug 1999 04:43:20 GMT
stoddard    99/08/20 21:43:18

  Modified:    mpm/src/main listen.c
               mpm/src/modules/mpm/winnt winnt.c
  Log:
  Forgot listen.c in the earlier AcceptEx patch to winnt.c.
  Enable winnt mpm to detech OS at runtime.
  
  Revision  Changes    Path
  1.5       +9 -0      apache-2.0/mpm/src/main/listen.c
  
  Index: listen.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/mpm/src/main/listen.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- listen.c	1999/07/26 07:03:09	1.4
  +++ listen.c	1999/08/21 04:43:08	1.5
  @@ -78,11 +78,20 @@
       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)
{
  
  
  
  1.10      +23 -13    apache-2.0/mpm/src/modules/mpm/winnt/winnt.c
  
  Index: winnt.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/mpm/src/modules/mpm/winnt/winnt.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- winnt.c	1999/08/20 20:20:33	1.9
  +++ winnt.c	1999/08/21 04:43:15	1.10
  @@ -94,6 +94,8 @@
   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 @@
   	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 @@
   	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 @@
   
       /* 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) {
  @@ -1359,6 +1366,9 @@
   {
       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");
  
  
  

Mime
View raw message