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

« back to all changes in this revision

Viewing changes to xr/dispatchmode/modestr.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 "dispatchmode"
 
2
#include "config/config"
 
3
 
 
4
string Dispatchmode::modestr() const {
 
5
    ostringstream o;
 
6
    
 
7
    switch (mode()) {
 
8
    case m_leastconn:
 
9
        return ("least-connections");
 
10
    case m_roundrobin:
 
11
        return ("round-robin");
 
12
    case m_firstactive:
 
13
        return ("first-available");
 
14
    case m_external:
 
15
        return (static_cast<string>("external:") + config.externalalgorithm());
 
16
    case m_strict_hashed_ip:
 
17
        return ("strict-hashed-ip");
 
18
    case m_lax_hashed_ip:
 
19
        return ("lax-hashed-ip");
 
20
    case m_strict_stored_ip:
 
21
        o << "strict-stored-ip:" << config.ipstoretimeout();
 
22
        return (o.str());
 
23
    case m_lax_stored_ip:
 
24
        o << "lax-stored-ip:" << config.ipstoretimeout();
 
25
        return (o.str());
 
26
    default:
 
27
        return ("unknown");
 
28
    }
 
29
}