crossroads

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

available.cc (563B)


      1 #include "backend"
      2 #include "profiler/profiler"
      3 #include "ipstore/ipstore"
      4 
      5 bool Backend::available() const {
      6     PROFILE("Backend::available");
      7 
      8     /*
      9     debugmsg("Back end " << description() << ": "
     10 	     << livestr() << ", " << upstr() << ", "
     11 	     << connections() << " connections, "
     12 	     << IPStore::anticipated(balancerindex()) << " anticipated, "
     13 	     << maxconn() << " max\n");
     14     */
     15     if (!maxconn())
     16 	return (islive && isup);
     17     return (islive &&
     18 	    isup &&
     19 	    (connections() + IPStore::anticipated(balancerindex()) <
     20 	     maxconn()));
     21 }