Roxen.git / server / base_server / configuration.pike

version» Context lines:

Roxen.git/server/base_server/configuration.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2001, Roxen IS.   //      // @appears Configuration   //! A site's main configuration    - constant cvs_version = "$Id: configuration.pike,v 1.503 2002/03/22 15:33:59 mast Exp $"; + constant cvs_version = "$Id: configuration.pike,v 1.504 2002/03/27 17:48:40 per-bash Exp $";   #include <module.h>   #include <module_constants.h>   #include <roxen.h>   #include <request_trace.h>   #include <timers.h>      #define CATCH(P,X) do{mixed e;if(e=catch{X;})report_error("While "+P+"\n"+describe_backtrace(e));}while(0)      // --- Locale defines ---   //<locale-token project="roxen_start"> LOC_S </locale-token>
Roxen.git/server/base_server/configuration.pike:170:    if( !id->misc->prof_stack ) id->misc->prof_stack = ProfStack();    id->misc->prof_stack->leave( name+":"+type,id );   }   #endif         /* A configuration.. */   inherit Configuration;   inherit "basic_defvar";    + static mapping(RequestID:mapping) current_connections = +  set_weak_flag( ([ ]), 1 ); +  + void connection_add( RequestID id, mapping data ) + //! Add a connection. The data mapping can contain things such as + //! currently sent bytes. + //! + //! See protocols/http.pike and slowpipe.pike for more information. + //! + //! You are not in any way forced to use this method from your + //! protocol module. The information is only used for debug purposes + //! in the configuration interface. + //! + //! You have to keep a reference to the mapping on your own, none is + //! kept by the configuration object. + { +  current_connections[id] = data; + } +  + mapping connection_drop( RequestID id ) + //! Remove a connection from the list of currently active connections. + //! Returns the mapping previously added with connection_add, if any. + { +  m_delete( current_connections, id ); + } +  + mapping(RequestID:mapping) connection_get( ) + //! Return all currently active connections. + { +  return current_connections; + } +    // It's nice to have the name when the rest of __INIT executes.   string name = roxen->bootstrap_info->get();      // Trivial cache (actually, it's more or less identical to the 200+   // lines of C in HTTPLoop. But it does not have to bother with the   // fact that more than one thread can be active in it at once. Also,   // it does not have to delay free until all current connections using   // the cache entry is done...)   class DataCache   {
Roxen.git/server/base_server/configuration.pike:2373:    datacache = DataCache( );    else    datacache->init_from_variables();       parse_log_formats();    init_log_file();    do_not_log_patterns = query("NoLog");    if(!sizeof(do_not_log_patterns))    do_not_log_patterns = 0;    +  if( query("throttle") ) +  { +  if( !throttler ) +  throttler=.throttler(); +  throttler->throttle(query("throttle_fill_rate"), +  query("throttle_bucket_depth"), +  query("throttle_min_grant"), +  query("throttle_max_grant")); +  } +  else if( throttler ) +  { +  // This is done to give old connections more bandwidth. +  throttler->throttle( 1000000000, 1000000000, // 800Mbit. +  1024, 65536 ); +  // and new connections does not even have to care. +  throttler = 0; +  } +    #ifdef SNMP_AGENT    if(query("snmp_process") && objectp(roxen->snmpagent))    roxen->snmpagent->add_virtserv(get_config_id());   #endif      }      void save_me()   {    save_one( 0 );
Roxen.git/server/base_server/configuration.pike:2901:    {   // case "MyWorldLocation":   // if(strlen(value)<7 || value[-1] != '/' ||   // !(sscanf(value,"%*s://%*s/")==2))   // return LOCALE->url_format();   // return 0;    case "MyWorldLocation":    case "URLs":    fix_my_url();    return 0; -  case "throttle": -  if (value) { -  THROTTLING_DEBUG("configuration: Starting throttler up"); -  throttler=.throttler(); -  throttler->throttle(query("throttle_fill_rate"), -  query("throttle_bucket_depth"), -  query("throttle_min_grant"), -  query("throttle_max_grant")); -  } else { -  if (throttler) { //check, or get a backtrace the first time it's set -  THROTTLING_DEBUG("configuration: Stopping throttler"); -  destruct(throttler); -  throttler=0; -  } -  } -  return 0; -  case "throttle_fill_rate": -  case "throttle_bucket_depth": -  case "throttle_min_grant": -  case "throttle_max_grant": -  THROTTLING_DEBUG("configuration: setting throttling parameter: "+ -  name+"="+value); -  throttler->throttle(query("throttle_fill_rate"), -  query("throttle_bucket_depth"), -  query("throttle_min_grant"), -  query("throttle_max_grant")); -  return 0; + // case "throttle": + // // There was code here to sett the throttling. That's not a + // // good idea. Moved to start. The code now also avoids + // // creating new throttle objects each time a value is changed. + // case "throttle_fill_rate": + // case "throttle_bucket_depth": + // case "throttle_min_grant": + // case "throttle_max_grant": + // return 0;   #ifdef SNMP_AGENT    case "snmp_process":    if (objectp(roxen->snmpagent)) {    int cid = get_config_id();    value ? roxen->snmpagent->add_virtserv(cid) : roxen->snmpagent->del_virtserv(cid);    }    return 0;   #endif    }   }
Roxen.git/server/base_server/configuration.pike:3621:   // report_debug("[defvar: %.1fms] ", (gethrtime()-st)/1000.0 );   // st = gethrtime();       mapping(string:mixed) retrieved_vars = retrieve("spider#0", this_object());    if (sizeof (retrieved_vars) && !retrieved_vars->compat_level)    // Upgrading an older configuration; default to 2.1 compatibility level.    set ("compat_level", "2.1");    setvars( retrieved_vars );      // report_debug("[restore: %.1fms] ", (gethrtime()-st)/1000.0 ); -  if (query("throttle")) -  { -  throttler=.throttler(); -  throttler->throttle(query("throttle_fill_rate"), -  query("throttle_bucket_depth"), -  query("throttle_min_grant"), -  query("throttle_max_grant")); +    } - } +       static int arent_we_throttling_server () {    return !query("throttle");   }   static int arent_we_throttling_request() {    return !query("req_throttle");   }      #ifdef SNMP_AGENT   private static int(0..1) snmp_disabled() {    return (!snmp_global_disabled() && !query("snmp_process"));   }   private static int(0..1) snmp_global_disabled() {    return (!objectp(roxen->snmpagent));   }   #endif