You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Nathan Schrenk <ns...@neog.com> on 1996/02/05 00:30:50 UTC

Here's a new timeout fix patch

This patch is just a bug fix -- it doesn't add any new functionality to 
Apache.  There have been requests to add different types of timeouts, 
etc, and this patch doesn't do anything like that.  This is a replacement 
for 84.timeout.patch and I think it's a 1.0.[2,3.whatever] type of fix, 
rather than a 1.1 new feature.  This patch doesn't make timeout_name a 
global, which seemed to be the biggest complaint about 84.timeout.patch.

If someone doesn't beat me to it, I'll have a patch for 1.1 which will 
add different types of timeouts (eg. BufferSendTimeout) so that different 
operations can have timeouts of different lengths.  Any thoughts on what 
operations need their own timeouts, and what the config file entries for 
these timeouts should look like?

Nathan

--
From: nschrenk@neog.com (Nathan Schrenk)
Subject: New timeout code fix
Affects: http_protocol.c, http_main.c, http_main.h
ChangeLog: Reset timeout timer after each successful fwrite() to the network.
           This patch adds a reset_timeout() procedure that is called by
           send_fd() to reset the timeout ever time data is written to the net. 

*** http_main.c.orig	Sun Feb  4 16:48:23 1996
--- http_main.c	Sun Feb  4 16:35:45 1996
***************
*** 211,217 ****
  
  static conn_rec *current_conn;
  static request_rec *timeout_req;
! static char *timeout_name;
  static int alarms_blocked = 0;
  static int alarm_pending = 0;
  
--- 211,217 ----
  
  static conn_rec *current_conn;
  static request_rec *timeout_req;
! static char *timeout_name = NULL;
  static int alarms_blocked = 0;
  static int alarm_pending = 0;
  
***************
*** 313,319 ****
      timeout_req = NULL;
      timeout_name = NULL;
  }
!  
  /*****************************************************************
   *
   * Dealing with the scoreboard... a lot of these variables are global
--- 313,333 ----
      timeout_req = NULL;
      timeout_name = NULL;
  }
! 
! /* reset_timeout (request_rec *) resets the timeout in effect,
!  * as long as it hasn't expired already.
!  */
! 
! void reset_timeout (request_rec *r) {
!     int i;
! 
!     if (timeout_name) { /* timeout has been set */
!         i = alarm(r->server->timeout);
!         if (i == 0) /* timeout already expired, so set it back to 0 */
! 	    alarm(0);
!     }
! }
! 
  /*****************************************************************
   *
   * Dealing with the scoreboard... a lot of these variables are global
*** http_main.h.orig	Sun Feb  4 16:42:26 1996
--- http_main.h	Sun Feb  4 16:41:52 1996
***************
*** 83,91 ****
   * implemented in http_main.c).
   *
   * kill_timeout() will disarm either variety of timeout.
   */
  
  void hard_timeout (char *, request_rec *);
  void soft_timeout (char *, request_rec *);
  void kill_timeout (request_rec *);     
! 
--- 83,93 ----
   * implemented in http_main.c).
   *
   * kill_timeout() will disarm either variety of timeout.
+  *
+  * reset_timeout() resets the timeout in progress.
   */
  
  void hard_timeout (char *, request_rec *);
  void soft_timeout (char *, request_rec *);
  void kill_timeout (request_rec *);     
! void reset_timeout (request_rec *);
*** http_protocol.c.orig	Sun Feb  4 15:48:46 1996
--- http_protocol.c	Sun Feb  4 16:37:51 1996
***************
*** 554,559 ****
--- 554,561 ----
  	
          while(n && !r->connection->aborted) {
              w=fwrite(&buf[o],sizeof(char),n,c->client);
+ 	    if (w)
+ 	        reset_timeout(r); /* reset timeout after successfule write */
              n-=w;
              o+=w;
          }