crossroads

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

target.cc (594B)


      1 #include "ipstore"
      2 
      3 IPStore::StoreMap IPStore::store;
      4 bool IPStore::onoff = false;
      5 
      6 int IPStore::target(struct in_addr clientip) {
      7     // Weed out the store, for decisions later
      8     weed();
      9 
     10     // Let's see if we know the client.
     11     if (store.count(clientip) > 0) {
     12 	if (config.verbose()) {
     13 	    Timestamp tm(store[clientip].lastaccess);
     14 	    msg("Client IP " << inet2string(clientip) << 
     15 		" last visited on " << tm.desc() << " and went to " <<
     16 		balancer.backend(store[clientip].targetbackend).description()
     17 		<< '\n');
     18 	}
     19 	return store[clientip].targetbackend;
     20     }
     21     return -1;
     22 }
     23