You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-cvs@httpd.apache.org by je...@apache.org on 2002/03/27 22:38:03 UTC

cvs commit: httpd-test/flood CHANGES flood_net.c flood_net.h flood_socket_keepalive.c

jerenkrantz    02/03/27 13:38:03

  Modified:    flood    CHANGES flood_net.c flood_net.h
                        flood_socket_keepalive.c
  Log:
  Add check_socket call to flood_net.h.  This attempts to determine if the
  other side has closed on us by doing a poll.  From my observations on
  Solaris, it seems that when a FIN is received from the other side,
  a POLLIN event is generated.  Odd.  I'd think it should be POLLERR or
  POLLHUP, but that doesn't seem to be the case.
  
  Revision  Changes    Path
  1.36      +3 -0      httpd-test/flood/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-test/flood/CHANGES,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- CHANGES	27 Mar 2002 01:41:52 -0000	1.35
  +++ CHANGES	27 Mar 2002 21:38:03 -0000	1.36
  @@ -1,5 +1,8 @@
   Changes since milestone-03:
   
  +* Add ability to detect when the server has closed the connection instead
  +  of erroring out (think Keep-Alive).  [Justin Erenkrantz]
  +
   * Add chunked support.  [Justin Erenkrantz]
   
   * Add detection of CAPATH variable for RedHat installs.
  
  
  
  1.8       +22 -1     httpd-test/flood/flood_net.c
  
  Index: flood_net.c
  ===================================================================
  RCS file: /home/cvs/httpd-test/flood/flood_net.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- flood_net.c	24 Aug 2001 04:26:39 -0000	1.7
  +++ flood_net.c	27 Mar 2002 21:38:03 -0000	1.8
  @@ -140,5 +140,26 @@
       if (l != r->rbufsize)
           return APR_EGENERAL;
   
  -    return APR_SUCCESS;     
  +    return e;
  +}
  +
  +apr_status_t check_socket(flood_socket_t *s, apr_pool_t *pool)
  +{
  +    apr_status_t e;
  +    int socketsRead = 1;
  +    apr_pollfd_t *pout;
  +    apr_int16_t event;
  +
  +    apr_poll_setup(&pout, 1, pool);
  +    apr_poll_socket_add(pout, s->socket, APR_POLLIN | APR_POLLPRI | APR_POLLERR | APR_POLLHUP | APR_POLLNVAL);
  +
  +    e = apr_poll(pout, &socketsRead, 1000);
  +    if (socketsRead) {
  +        apr_poll_revents_get(&event, s->socket, pout);
  +        if (event) {
  +            return APR_EGENERAL;
  +        }
  +    }
  +    
  +    return APR_SUCCESS;
   }
  
  
  
  1.6       +1 -0      httpd-test/flood/flood_net.h
  
  Index: flood_net.h
  ===================================================================
  RCS file: /home/cvs/httpd-test/flood/flood_net.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- flood_net.h	1 Aug 2001 03:28:01 -0000	1.5
  +++ flood_net.h	27 Mar 2002 21:38:03 -0000	1.6
  @@ -71,5 +71,6 @@
   void close_socket(flood_socket_t *s);
   apr_status_t write_socket(flood_socket_t *s, request_t *r);
   apr_status_t read_socket(flood_socket_t *s, char *buf, int *buflen);
  +apr_status_t check_socket(flood_socket_t *s, apr_pool_t *pool);
   
   #endif  /* __flood_socket_h */
  
  
  
  1.13      +7 -0      httpd-test/flood/flood_socket_keepalive.c
  
  Index: flood_socket_keepalive.c
  ===================================================================
  RCS file: /home/cvs/httpd-test/flood/flood_socket_keepalive.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- flood_socket_keepalive.c	27 Mar 2002 18:52:25 -0000	1.12
  +++ flood_socket_keepalive.c	27 Mar 2002 21:38:03 -0000	1.13
  @@ -104,6 +104,13 @@
   {
       keepalive_socket_t *ksock = (keepalive_socket_t *)sock;
   
  +    if (!ksock->reopen_socket && ksock->s) {
  +        apr_status_t e;
  +        e = check_socket(ksock->s, pool);
  +        if (e != APR_SUCCESS) {
  +            ksock->reopen_socket = 1;
  +        }
  +    }
       if (ksock->reopen_socket || ksock->s == NULL) {
           if (strcasecmp(req->parsed_uri->scheme, "https") == 0) {
           /* If we don't have SSL, error out. */
  
  
  

Re: cvs commit: httpd-test/flood CHANGES flood_net.c flood_net.h flood_socket_keepalive.c

Posted by Aaron Bannert <aa...@clove.org>.
On Wed, Mar 27, 2002 at 09:38:03PM -0000, jerenkrantz@apache.org wrote:
> jerenkrantz    02/03/27 13:38:03
> 
>   Modified:    flood    CHANGES flood_net.c flood_net.h
>                         flood_socket_keepalive.c
>   Log:
>   Add check_socket call to flood_net.h.  This attempts to determine if the
>   other side has closed on us by doing a poll.  From my observations on
>   Solaris, it seems that when a FIN is received from the other side,
>   a POLLIN event is generated.  Odd.  I'd think it should be POLLERR or
>   POLLHUP, but that doesn't seem to be the case.

That's because a passive close is not an error, it just means the
server closed before the client (flood) did. If you're blocking
in read() you'll get a return of 0 bytes (EOF).

-aaron