~ubuntu-branches/ubuntu/precise/crossroads/precise

« back to all changes in this revision

Viewing changes to xr/backenddef/backenddef1.cc

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Ritter
  • Date: 2010-07-05 16:27:00 UTC
  • Revision ID: james.westby@ubuntu.com-20100705162700-0g08tfav8ee9y51u
Tags: upstream-2.65
ImportĀ upstreamĀ versionĀ 2.65

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "backenddef"
 
2
 
 
3
unsigned BackendDef::min_wt;
 
4
unsigned BackendDef::max_wt;
 
5
bool BackendDef::minmax_wt_set = false;
 
6
 
 
7
BackendDef::BackendDef (string server, string port,
 
8
                        string maxclients, string w) :
 
9
    srv(server), prt(-1), max(0), host_match(""), url_match(""),
 
10
    wt(1), backend_check() {
 
11
 
 
12
    if (sscanf (port.c_str(), "%d", &prt) < 1)
 
13
        throw Error("Bad backend port specifier: '" + port +
 
14
                    "' is not a number");
 
15
    if (maxclients.size() &&
 
16
        sscanf (maxclients.c_str(), "%u", &max) < 1)
 
17
        throw Error("Bad maximum connections specifier: '" +
 
18
                    maxclients + "' is not a number");
 
19
 
 
20
    unsigned ww;
 
21
    if (sscanf(w.c_str(), "%u", &ww) < 1)
 
22
        throw Error("Bad backend weight specifier: '" + w +
 
23
                    "' is not a number");
 
24
    if (ww < 1)
 
25
        throw Error("Weights less than 1 are not supported");
 
26
    weight(ww);
 
27
}