crossroads

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

target.cc (573B)


      1 #include "firstactive"
      2 
      3 unsigned Firstactive::target(struct in_addr clientip,
      4 			     BackendVector &targetlist) {
      5     if (config.debug()) {
      6 	debugmsg("First-active algorithm: " << targetlist.size() <<
      7 		 " back end(s) to consider\n");
      8 	for (unsigned int i = 0; i < targetlist.size(); i++)
      9 	    debugmsg("  Considering back end " << targetlist[i] <<
     10 		     " which is " <<
     11 		     balancer.backend(targetlist[i]).description() << '\n');
     12     }
     13     if (targetlist.size() == 0)
     14 	throw Error("First-active algorithm: no available back ends");
     15     return (targetlist[0]);
     16 }
     17