Roxen.git / server / base_server / roxen.pike

version» Context lines:

Roxen.git/server/base_server/roxen.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2004, Roxen IS.   //   // The Roxen WebServer main program.   //   // 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.996 2008/10/12 22:14:03 mast Exp $"; + constant cvs_version="$Id: roxen.pike,v 1.997 2008/10/26 20:26:31 mast Exp $";      //! @appears roxen   //!   //! The Roxen WebServer main program.      // The argument cache. Used by the image cache.   ArgCache argcache;      // Some headerfiles   #define IN_ROXEN
Roxen.git/server/base_server/roxen.pike:530: Inside #if defined(SNMP_AGENT)
  #ifdef SNMP_AGENT    if(objectp(snmpagent)) {    snmpagent->stop_trap();    snmpagent->disable();    }   #endif       call_out(really_low_shutdown, 0.1, exit_code);   }    + private int shutdown_started; +    // Perhaps somewhat misnamed, really... This function will close all   // listen ports and then quit. The 'start' script should then start a   // new copy of roxen automatically.   void restart(float|void i, void|int exit_code)   //! Restart roxen, if the start script is running   { -  +  shutdown_started = 1;    call_out(low_shutdown, i, exit_code || -1);   }      void shutdown(float|void i)   //! Shut down roxen   { -  +  shutdown_started = 1;    call_out(low_shutdown, i, 0);   }      void exit_when_done()   {    report_notice("Interrupt request received.\n"); -  +  shutdown_started = 1;    low_shutdown(-1);   }    -  + int is_shutting_down() + //! Returns true if Roxen is shutting down. + { +  return shutdown_started; + }    -  +    /*    * handle() stuff    */      #ifdef THREADS   // function handle = threaded_handle;      Thread do_thread_create(string id, function f, mixed ... args)   {    Thread.Thread t = thread_create(f, @args);
Roxen.git/server/base_server/roxen.pike:720: Inside #if defined(THREADS), #if undefined(NO_SLOW_REQ_BT) and #if defined(DEBUG)
   (Pike.DefaultBackend->after_callback &&    Pike.DefaultBackend->after_callback != slow_be_after_cb))    werror ("Pike.DefaultBackend already hooked up with "    "other before/after callbacks - they get overwritten: %O/%O\n",    Pike.DefaultBackend->before_callback,    Pike.DefaultBackend->after_callback);   #endif       if (query ("slow_req_bt_count") && slow_be_timeout > 0.0 &&    // Don't trig if we're shutting down. -  !shutdown_recurse) { +  !shutdown_started) {    Pike.DefaultBackend->before_callback = slow_be_before_cb;    Pike.DefaultBackend->after_callback = slow_be_after_cb;    }    else {    Pike.DefaultBackend->before_callback = 0;    Pike.DefaultBackend->after_callback = 0;    if (Pike.Backend monitor = slow_be_call_out && slow_req_monitor) {    monitor->remove_call_out (slow_be_call_out);    slow_be_call_out = 0;    }
Roxen.git/server/base_server/roxen.pike:1170: Inside #if defined(THREADS)
      int maxbeats =    min (time() - bg_last_busy, bg_time_buffer_max) * (int) (1 / 0.04);      #ifndef NO_SLOW_REQ_BT    Pike.Backend monitor;    mixed call_out;   #endif       if (mixed err = catch { -  while (bg_queue->size()) { +  while (bg_queue->size() && !shutdown_started) {    // Not a race here since only one thread is reading the queue.    array task = bg_queue->read();       // Wait a while if another thread is busy already.    if (busy_threads > 1) {    for (maxbeats = max (maxbeats, (int) (bg_time_buffer_min / 0.04));    busy_threads > 1 && maxbeats > 0;    maxbeats--)    // Pike implementation note: If 0.02 or smaller, we'll busy wait here.    sleep (0.04);
Roxen.git/server/base_server/roxen.pike:1770:    } else    c = mu->conf;    }    requesthandler( q, this_object(), c );    }    }       local function sp_fcfu;       -  +  // FIXME: find_configuration_for_url can be called from the backend +  // thread, so enable_all_modules should be queued for a handler thread.   #define INIT(X) do{ \    mapping _=(X); \    string __=_->path; \    c=_->conf; \    if(__&&id->adjust_for_config_path) \    id->adjust_for_config_path(__); \    if(!c->inited) \    c->enable_all_modules(); \    } while(0)