Commit fb53124b authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(parameters): Added "Default priority", "Max priority", "Default

	weight" and "Max weight".
(require_less_eq): New static function.
(read_configuration): Check the new parameters.  For now,
	max_priority must be set to 0, since connections.c can only
	handle a single priority.
parent 1ea1083f
/*
* $Id: server-config.c,v 0.93 2003/08/03 13:28:38 ceder Exp $
* $Id: server-config.c,v 0.94 2003/08/14 23:01:13 ceder Exp $
* Copyright (C) 1991-1999, 2001-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -276,6 +276,26 @@ static const struct parameter parameters[] = {
&param.low_penalty,
NULL},
{"Default priority",
assign_uint, NULL, 0, 1, "0",
&param.default_priority,
NULL},
{"Max priority",
assign_uint, NULL, 0, 1, "0",
&param.max_priority,
NULL},
{"Default weight",
assign_uint, NULL, 0, 1, "20",
&param.default_weight,
NULL},
{"Max weight",
assign_uint, NULL, 0, 1, "100",
&param.max_weight,
NULL},
/* Client inactivity timeouts. */
{"Connect timeout",
......@@ -644,6 +664,15 @@ require_less(void *low,
param_name(high));
}
static void
require_less_eq(void *low,
void *high)
{
kom_log("Parameter '%s' must be less than or equal to parameter '%s'.\n",
param_name(low),
param_name(high));
}
void
read_configuration(const char *conf_file)
{
......@@ -755,6 +784,50 @@ read_configuration(const char *conf_file)
require_less(&param.low_penalty, &param.max_penalty);
}
if (param.default_weight < 1)
{
err = TRUE;
kom_log("Parameter '%s' must be at least 1.\n",
param_name(&param.default_weight));
}
if (param.default_weight > param.max_weight)
{
err = TRUE;
require_less_eq(&param.default_weight,
&param.max_weight);
}
if (param.default_priority > param.max_priority)
{
err = TRUE;
require_less_eq(&param.default_priority,
&param.max_priority);
}
if (param.max_priority > 0)
{
err = TRUE;
kom_log("Parameter '%s' must be at most 0.\n",
param_name(&param.max_priority));
}
/* This limit stops a potential overflow in adjust_penalty(). */
if (param.max_weight >= 0x10000)
{
err = TRUE;
kom_log("Parameter '%s' must be at most %d.\n",
param_name(&param.max_weight), 0x10000);
}
/* This limit stops a potential overflow in adjust_penalty(). */
if (param.max_penalty >= 0x8000)
{
err = TRUE;
kom_log("Parameter '%s' must be at most %d.\n",
param_name(&param.max_weight), 0x8000);
}
/* FIXME (bug 165): Check config parameters for sanity.
One thing to check is:
The following should always be true:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment