httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject [PATCH] PR#502: timeout problems
Date Fri, 02 May 1997 22:03:04 GMT
The rfc1413 code did some bogosity with alarm().  This patch hopefully
works around the bogosity in such a way to get a working 1.2.  We've
mumbled in the past that we need proper timeout code to handle multiple
outstanding timeouts... that'll have to wait until post-1.2. 

Mark can you give this a try and see if it helps? (With IdentityCheck on.) 

Thanks
Dean

Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.142
diff -c -3 -r1.142 http_main.c
*** http_main.c	1997/04/29 02:39:01	1.142
--- http_main.c	1997/05/02 22:00:07
***************
*** 338,343 ****
--- 338,344 ----
  static char *timeout_name = NULL;
  static int alarms_blocked = 0;
  static int alarm_pending = 0;
+ static int last_timeout_length;
  
  #ifndef NO_USE_SIGACTION
  /*
***************
*** 438,443 ****
--- 439,445 ----
      }
  }
  
+ 
  void keepalive_timeout (char *name, request_rec *r)
  {
      timeout_req = r;
***************
*** 445,453 ****
      
      signal(SIGALRM, timeout);
      if (r->connection->keptalive) 
!        alarm (r->server->keep_alive_timeout);
      else
!        alarm (r->server->timeout);
  }
  
  void hard_timeout (char *name, request_rec *r)
--- 447,456 ----
      
      signal(SIGALRM, timeout);
      if (r->connection->keptalive) 
!        last_timeout_length = r->server->keep_alive_timeout;
      else
!        last_timeout_length = r->server->timeout;
!     alarm (last_timeout_length);
  }
  
  void hard_timeout (char *name, request_rec *r)
***************
*** 456,462 ****
      timeout_name = name;
      
      signal(SIGALRM, timeout);
!     alarm (r->server->timeout);
  }
  
  void soft_timeout (char *name, request_rec *r)
--- 459,466 ----
      timeout_name = name;
      
      signal(SIGALRM, timeout);
!     last_timeout_length = r->server->timeout;
!     alarm (last_timeout_length);
  }
  
  void soft_timeout (char *name, request_rec *r)
***************
*** 464,476 ****
      timeout_name = name;
      
      signal(SIGALRM, timeout);
!     alarm (r->server->timeout);
  }
  
  void kill_timeout (request_rec *dummy) {
      alarm (0);
      timeout_req = NULL;
      timeout_name = NULL;
  }
  
  /* reset_timeout (request_rec *) resets the timeout in effect,
--- 468,493 ----
      timeout_name = name;
      
      signal(SIGALRM, timeout);
!     last_timeout_length = r->server->timeout;
!     alarm (last_timeout_length);
  }
  
  void kill_timeout (request_rec *dummy) {
+     last_timeout_length = 0;
      alarm (0);
      timeout_req = NULL;
      timeout_name = NULL;
+ }
+ 
+ /* XXX: this is just a quick hack to get us through 1.2, we really need
+  * proper timeout management.  See rfc1413.c for why this is used.  Bleh.
+  */
+ void restore_timeout ()
+ {
+     if( last_timeout_length ) {
+ 	signal(SIGALRM, timeout);
+ 	alarm(last_timeout_length);
+     }
  }
  
  /* reset_timeout (request_rec *) resets the timeout in effect,
Index: http_main.h
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.h,v
retrieving revision 1.10
diff -c -3 -r1.10 http_main.h
*** http_main.h	1997/04/26 20:20:06	1.10
--- http_main.h	1997/05/02 22:00:07
***************
*** 83,88 ****
--- 83,92 ----
   * kill_timeout() will disarm either variety of timeout.
   *
   * reset_timeout() resets the timeout in progress.
+  *
+  * restore_timeout() is used by rfc1413.c to restore the global timeout
+  * after it hacks away at it.  It should be replaced by more general
+  * timeout management post-1.2.
   */
  
  void hard_timeout (char *, request_rec *);
***************
*** 90,95 ****
--- 94,100 ----
  void soft_timeout (char *, request_rec *);
  void kill_timeout (request_rec *);     
  void reset_timeout (request_rec *);
+ void restore_timeout ();
  
  void sync_scoreboard_image ();
  int update_child_status (int child_num, int status, request_rec *r);
Index: rfc1413.c
===================================================================
RCS file: /export/home/cvs/apache/src/rfc1413.c,v
retrieving revision 1.9
diff -c -3 -r1.9 rfc1413.c
*** rfc1413.c	1997/03/07 17:43:36	1.9
--- rfc1413.c	1997/05/02 22:00:07
***************
*** 74,79 ****
--- 74,80 ----
  
  #include "httpd.h"    /* for server_rec, conn_rec */
  #include "http_log.h" /* for log_unixerr */
+ #include "http_main.h"
  #include "rfc1413.h"
  
  /* System libraries. */
***************
*** 221,226 ****
--- 222,228 ----
  
  	alarm(0);
      }
+     restore_timeout();
      close(sock);
      conn->remote_logname = result;
  


Mime
View raw message