crossroads

Git mirror of https://crossroads.e-tunity.com/
git clone git://git.finwo.net/app/crossroads
Log | Files | Refs | LICENSE

startdispatcher.cc (924B)


      1 #include "dispatcher"
      2 
      3 void Dispatcher::start_dispatcher() {
      4     // Instantiate dispatchmode algorithm
      5     switch (config.dispatchmode()) {
      6     case Dispatchmode::m_roundrobin:
      7 	algo = new Roundrobin;
      8 	break;
      9     case Dispatchmode::m_firstactive:
     10 	algo = new Firstactive;
     11 	break;
     12     case Dispatchmode::m_external:
     13 	algo = new External;
     14 	break;
     15     case Dispatchmode::m_strict_hashed_ip:
     16     case Dispatchmode::m_lax_hashed_ip:
     17 	algo = new HashedIp;
     18 	break;
     19     case Dispatchmode::m_strict_stored_ip:
     20     case Dispatchmode::m_lax_stored_ip:
     21 	algo = new StoredIp;
     22 	break;
     23     case Dispatchmode::m_weighted_load:
     24 	algo = new Weightedload;
     25 	break;
     26     case Dispatchmode::m_leastconn:
     27     default:
     28 	algo = new Leastconn;
     29 	break;
     30     }
     31 
     32     // NOTE: Memory errors for algorithm pointer are not handled here,
     33     // but in dispatch() (don't want to throw up in the constructor)
     34 
     35     debugmsg("Dispatcher instantiated.\n");
     36 }
     37