anticipated.cc (578B)
1 #include "ipstore" 2 3 unsigned IPStore::anticipated(unsigned b) { 4 if (!onoff || b >= balancer.nbackends()) 5 return 0; 6 7 // Weed store for decisions later 8 weed(); 9 10 // Get number of anticipated clients for given back end 11 unsigned ret = 0; 12 static int lock; 13 14 mutex_lock(&lock); 15 for (StoreMap::iterator iter = store.begin(); 16 iter != store.end(); 17 iter++) 18 if ((*iter).second.targetbackend == (int)b) 19 ret++; 20 mutex_unlock(&lock); 21 22 debugmsg("Anticipated connections for back end " << b << ": " << 23 ret << '\n'); 24 return ret; 25 } 26 27