httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Sutton <p...@ukweb.com>
Subject Listens on NT (fwd)
Date Sat, 23 Aug 1997 12:56:42 GMT
This might need updating 'cos of other listener changes...

---------- Forwarded message ----------
Date: Fri, 27 Jun 1997 10:31:39 +0100 (BST)
From: Paul Sutton <paul@ukweb.com>
Reply-To: new-httpd@apache.org
To: new-httpd@hyperreal.org
Subject: 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;




Mime
View raw message