Branch: Tag:

2008-09-22

2008-09-22 15:18:02 by Martin Stjernholm <mast@lysator.liu.se>

Use a float for the slow request timeout.

Rev: server/base_server/global_variables.pike:1.112
Rev: server/base_server/roxen.pike:1.988

6:   // Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.   // ABS and suicide systems contributed freely by Francesco Chemolli    - constant cvs_version="$Id: roxen.pike,v 1.987 2008/09/22 12:07:59 mast Exp $"; + constant cvs_version="$Id: roxen.pike,v 1.988 2008/09/22 15:18:02 mast Exp $";      //! @appears roxen   //!
611: Inside #if defined(THREADS) and #if undefined(NO_SLOW_REQ_BT)
  // longer than a configurable timeout.      protected Pike.Backend slow_req_monitor; // Set iff slow req bt is enabled. - protected int slow_req_timeout; + protected float slow_req_timeout;      protected void slow_req_monitor_thread (Pike.Backend my_monitor)   {
621: Inside #if defined(THREADS) and #if undefined(NO_SLOW_REQ_BT)
   slow_req_monitor (3600);   }    - void set_slow_req_timeout (int secs) + void set_slow_req_timeout (float secs)   {   #ifdef DEBUG    if (secs < 0) error ("Invalid timeout.\n");
630: Inside #if defined(THREADS) and #if undefined(NO_SLOW_REQ_BT)
   Pike.Backend monitor = slow_req_monitor;    slow_req_timeout = secs;    -  if (secs && monitor) { +  if (secs > 0.0 && monitor) {    // Just a change of timeout - nothing more to do.    }    -  else if (secs) { // Start. +  else if (secs > 0.0) { // Start.    monitor = slow_req_monitor = Pike.SmallBackend();    Thread.thread_create (slow_req_monitor_thread, monitor);    monitor->call_out (lambda () {}, 0); // Safeguard if there's a race.
646: Inside #if defined(THREADS) and #if undefined(NO_SLOW_REQ_BT)
   }   }    - protected void dump_slow_req (Thread.Thread thread, int timeout) + protected void dump_slow_req (Thread.Thread thread, float timeout)   { -  report_debug ("### Thread 0x%x has been busy for more than %d seconds.\n", +  report_debug ("### Thread 0x%x has been busy for more than %g seconds.\n",    thread->id_number(), timeout);    describe_all_threads();   }
5345:    }      #ifndef NO_SLOW_REQ_BT -  if (int timeout = query ("slow_req_bt")) -  if (timeout > 0) +  if (float timeout = query ("slow_req_bt")) +  if (timeout > 0.0)    set_slow_req_timeout (timeout);   #endif