httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: httpd-2.0/support ab.c
Date Sun, 14 Dec 2003 00:50:20 GMT
trawick     2003/12/13 16:50:20

  Modified:    .        Tag: APACHE_2_0_BRANCH STATUS
               support  Tag: APACHE_2_0_BRANCH ab.c
  Log:
  merge some ab fixes from 2.1-dev
  
  Submitted by:	trawick
  Reviewed by:	brianp, ianh
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.751.2.598 +1 -7      httpd-2.0/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/STATUS,v
  retrieving revision 1.751.2.597
  retrieving revision 1.751.2.598
  diff -u -r1.751.2.597 -r1.751.2.598
  --- STATUS	14 Dec 2003 00:26:12 -0000	1.751.2.597
  +++ STATUS	14 Dec 2003 00:50:20 -0000	1.751.2.598
  @@ -209,12 +209,6 @@
                 Yes, I think, a useful error message is better than
                 a coredump in this case.
   
  -    * More ab fixes; r1.129 fixes what looks like a trivial error in the 
  -      SSL support; r1.130 adds some state-handling fixes related to
  -      ab's breakage in 2.0.47
  -        support/ab.c: r1.129, r1.130
  -      +1: trawick, brianp, ianh
  -
       * mod_rewrite: more or less cosmetic fix. If a .htaccess in DocumentRoot
         configures:
           RewriteBase /
  
  
  
  No                   revision
  No                   revision
  1.121.2.5 +40 -11    httpd-2.0/support/ab.c
  
  Index: ab.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/support/ab.c,v
  retrieving revision 1.121.2.4
  retrieving revision 1.121.2.5
  diff -u -r1.121.2.4 -r1.121.2.5
  --- ab.c	15 Sep 2003 15:40:06 -0000	1.121.2.4
  +++ ab.c	14 Dec 2003 00:50:20 -0000	1.121.2.5
  @@ -227,8 +227,11 @@
   
   /* good old state hostname */
   #define STATE_UNCONNECTED 0
  -#define STATE_CONNECTING  1
  -#define STATE_READ        2
  +#define STATE_CONNECTING  1     /* TCP connect initiated, but we don't
  +                                 * know if it worked yet
  +                                 */
  +#define STATE_CONNECTED   2     /* we know TCP connect completed */
  +#define STATE_READ        3
   
   #define CBUFFSIZE (2048)
   
  @@ -668,7 +671,7 @@
               case SSL_ERROR_WANT_CONNECT:
                   BIO_printf(bio_err, "Waiting .. sleep(1)\n");
                   apr_sleep(apr_time_from_sec(1));
  -                c->state = STATE_CONNECTING;
  +                c->state = STATE_CONNECTED;
                   c->rwrite = 0;
                   break;
               case SSL_ERROR_ZERO_RETURN:
  @@ -770,6 +773,7 @@
   
   #ifdef USE_SSL
           if (ssl != 1)
  +#endif
   	if (e != APR_SUCCESS) {
   	    /*
   	     * Let's hope this traps EWOULDBLOCK too !
  @@ -781,7 +785,6 @@
   	    }
   	    return;
   	}
  -#endif
   	c->rwrote += l;
   	c->rwrite -= l;
       } while (1);
  @@ -1256,7 +1259,7 @@
   	    c->state = STATE_CONNECTING;
   	    c->rwrite = 0;
               new_pollfd.desc_type = APR_POLL_SOCKET;
  -            new_pollfd.reqevents = APR_POLLOUT | APR_POLLIN;
  +            new_pollfd.reqevents = APR_POLLOUT;
               new_pollfd.desc.s = c->aprsock;
               new_pollfd.client_data = c;
   	    apr_pollset_add(readbits, &new_pollfd);
  @@ -1281,6 +1284,7 @@
       }
   
       /* connected first time */
  +    c->state = STATE_CONNECTED;
       started++;
       write_request(c);
   }
  @@ -1735,8 +1739,34 @@
   		start_connect(c);
   		continue;
   	    }
  -	    if (rv & APR_POLLOUT)
  -		write_request(c);
  +	    if (rv & APR_POLLOUT) {
  +                if (c->state == STATE_CONNECTING) {
  +                    apr_pollfd_t remove_pollfd;
  +                    rv = apr_connect(c->aprsock, destsa);
  +                    remove_pollfd.desc_type = APR_POLL_SOCKET;
  +                    remove_pollfd.desc.s = c->aprsock;
  +                    apr_pollset_remove(readbits, &remove_pollfd);
  +                    if (rv != APR_SUCCESS) {
  +                        apr_socket_close(c->aprsock);
  +                        err_conn++;
  +                        if (bad++ > 10) {
  +                            fprintf(stderr,
  +                                    "\nTest aborted after 10 failures\n\n");
  +                            apr_err("apr_connect()", rv);
  +                        }
  +                        c->state = STATE_UNCONNECTED;
  +                        start_connect(c);
  +                        continue;
  +                    }
  +                    else {
  +                        c->state = STATE_CONNECTED;
  +                        write_request(c);
  +                    }
  +                }
  +                else {
  +                    write_request(c);
  +                }
  +            }
   
   	    /*
   	     * When using a select based poll every time we check the bits
  @@ -1748,8 +1778,7 @@
   #ifdef USE_SSL
               if (ssl != 1)
   #endif
  -	    if (c->state == STATE_READ ||
  -                c->state == STATE_CONNECTING) {
  +                if (c->state == STATE_READ) {
                       apr_pollfd_t new_pollfd;
                       new_pollfd.desc_type = APR_POLL_SOCKET;
                       new_pollfd.reqevents = APR_POLLIN;
  
  
  

Mime
View raw message