decrclientcount.c (975B)
1 /************************************************************************* 2 * This file is part of Crosroads 1.23, a load balancer and fail over 3 * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. 4 * Visit http://crossroads.e-tunity.com for information. 5 *************************************************************************/ 6 7 #include "crossroads.h" 8 9 void decr_client_count () { 10 unsigned totclients = 0; 11 int i; 12 13 if (program_stage != stage_serving) 14 return; 15 16 if (servicereport->backendstate[current_backend].nclients > 0) { 17 lock_reporter(); 18 servicereport->backendstate[current_backend].nclients--; 19 for (i = 0; i < activeservice->nbackend; i++) 20 totclients += 21 servicereport->backendstate[i].nclients; 22 servicereport->nclients = totclients; 23 msg ("Service %s: total active clients now %u", 24 activeservice->name, totclients); 25 unlock_reporter(); 26 } 27 sysrun (activeservice->backend[current_backend].onend); 28 }