You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Paul Sutton <pa...@ukweb.com> on 1997/06/27 11:31:39 UTC

Listens on NT

Listen doesn't work on the NT port. The code which checks the output of
the select() seems to be very broken (i.e. it can't ever have worked since
it always picks the fd of the last listener in the list, irrespective of
the FD_ISSET). Also the error checking after accept() is wrong. 

Here is a patch which seems to fix it. I can get Apache NT to listen on
multiple IPs and ports with "Listen" anyway. I was working with a version
before the recent listeners code changes, which might affect this.  In any
case it would be worth merging the listeners changes into the
Win32/multithreaded worker_main() for consistency. 

//pcs

Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.160
diff -c -r1.160 http_main.c
*** http_main.c	1997/06/24 18:15:19	1.160
--- http_main.c	1997/06/27 09:22:09
***************
*** 3160,3186 ****
                  continue;
          }
  
!         {
! 	    listen_rec *lr;
! 	    int fd;
! 	    
! 	    for (lr=listeners; lr != NULL; lr=lr->next)
! 	    {
! 	        if(!lr->used)
!                     continue;
!                 fd=lr->fd;
! 	        
! 	        FD_ISSET(fd, &listenfds);
! 	        sd = fd;
!                 break;
! 	    }
          }
  
          do {
              clen = sizeof(sa_client);
              csd  = accept(sd, (struct sockaddr *)&sa_client, &clen);
  #ifdef WIN32
!             if(csd == SOCKET_ERROR)
              {
                  csd = -1;
                  errno = WSAGetLastError() - WSABASEERR;
--- 3160,3177 ----
                  continue;
          }
  
!         if (listeners != NULL) {
!   	    for (sd = listenmaxfd; sd >= 0; sd--)
! 	        if (FD_ISSET(sd, &main_fds)) break;
! 	    if (sd < 0)
! 		continue;
          }
  
          do {
              clen = sizeof(sa_client);
              csd  = accept(sd, (struct sockaddr *)&sa_client, &clen);
  #ifdef WIN32
!             if(csd == INVALID_SOCKET)
              {
                  csd = -1;
                  errno = WSAGetLastError() - WSABASEERR;



Re: Listens on NT

Posted by Dean Gaudet <dg...@arctic.org>.
Make sure you've got the latest code from http_config.c -- in the last
week I changed it so that there would always be at least one listener.

Dean

On Fri, 27 Jun 1997, Mark J Cox wrote:

> > Here is a patch which seems to fix it. I can get Apache NT to listen on
> > multiple IPs and ports with "Listen" anyway. 
> 
> This patch works.  But now if you don't have any "Listen" directives in
> your config files it gets very confused.
> 
> Mark
> 
> 


Re: Listens on NT

Posted by Mark J Cox <ma...@ukweb.com>.
> Here is a patch which seems to fix it. I can get Apache NT to listen on
> multiple IPs and ports with "Listen" anyway. 

This patch works.  But now if you don't have any "Listen" directives in
your config files it gets very confused.

Mark