void
DelaySpec::parse()
{
- int r;
- char *token;
- token = strtok(NULL, "/");
-
+ // get the token.
+ char *token = ConfigParser::NextToken();
if (token == NULL)
self_destruct();
- if (sscanf(token, "%d", &r) != 1)
- self_destruct();
+ // no-limit value
+ if (strcmp(token, "none") == 0 || token[0] == '-') {
+ restore_bps = -1;
+ max_bytes = -1;
+ return;
+ }
- restore_bps = r;
+ // parse the first digits into restore_bps
+ const char *p = NULL;
+ if (!StringToInt(token, restore_bps, &p, 10) && *p != '/') {
+ debugs(77, DBG_CRITICAL, "ERROR: invalid delay rate '" << token << "'. Expecting restore/max or 'none'.");
+ self_destruct();
+ }
+ p++; // increment past the '/'
- max_bytes = GetInteger64();
+ // parse the rest into max_bytes
+ if (!StringToInt64(p, max_bytes, NULL, 10)) {
+ debugs(77, DBG_CRITICAL, "ERROR: restore rate in '" << token << "' is not a number.");
+ self_destruct();
+ }
}
#endif
description of delay_class.
For a class 1 delay pool, the syntax is:
- delay_pools pool 1
+ delay_class pool 1
delay_parameters pool aggregate
For a class 2 delay pool:
- delay_pools pool 2
+ delay_class pool 2
delay_parameters pool aggregate individual
For a class 3 delay pool:
- delay_pools pool 3
+ delay_class pool 3
delay_parameters pool aggregate network individual
For a class 4 delay pool:
- delay_pools pool 4
+ delay_class pool 4
delay_parameters pool aggregate network individual user
For a class 5 delay pool:
- delay_pools pool 5
+ delay_class pool 5
delay_parameters pool tagrate
The option variables are:
above example, and is being used to strictly limit each host to 64Kbit/sec
(plus overheads), with no overall limit, the line is:
- delay_parameters 1 -1/-1 8000/8000
+ delay_parameters 1 none 8000/8000
Note that 8 x 8000 KByte/sec -> 64Kbit/sec.
- Note that the figure -1 is used to represent "unlimited".
+ Note that the word 'none' is used to represent no limit.
And, if delay pool number 2 is a class 3 delay pool as in the above