src/backend.c
static int
smp_fetch_connslots(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
                    const struct arg *args, struct sample *smp)
{
	struct server *iterator;

	smp->flags = SMP_F_VOL_TEST;
	smp->type = SMP_T_UINT;
	smp->data.uint = 0;

	for (iterator = args->data.prx->srv; iterator; iterator = iterator->next) {
		if ((iterator->state & SRV_RUNNING) == 0)
			continue;

		if (iterator->maxconn == 0 || iterator->maxqueue == 0) {
			/* configuration is stupid */
			smp->data.uint = -1;  /* FIXME: stupid value! */
			return 1;
		}

		smp->data.uint += (iterator->maxconn - iterator->cur_sess)
		                       +  (iterator->maxqueue - iterator->nbpend);
	}

	return 1;
}
/* set temp integer to the number of enabled servers on the proxy.
 * Accepts exactly 1 argument. Argument is a backend, other types will lead to
 * undefined behaviour.
 */
set temp integer to the number of enabled servers on the proxy.
Accepts exactly 1 argument. Argument is a backend, other types will lead to
undefined behaviour.
set temp integer to the number of enabled servers on the proxy . Accepts exactly 1 argument . Argument is a backend other types will lead to undefined behaviour .
static int
smp_fetch_connslots(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
                    const struct arg *args, struct sample *smp)
{
	struct server *iterator;
	smp->flags = SMP_F_VOL_TEST;
	smp->type = SMP_T_UINT;
	smp->data.uint = 0;
	for (iterator = args->data.prx->srv; iterator; iterator = iterator->next) {
		if ((iterator->state & SRV_RUNNING) == 0)
			continue;
		if (iterator->maxconn == 0 || iterator->maxqueue == 0) {
			smp->data.uint = -1;  
			return 1;
		}
		smp->data.uint += (iterator->maxconn - iterator->cur_sess)
		                       +  (iterator->maxqueue - iterator->nbpend);
	}
	return 1;
}
static int smp_fetch_connslots ( struct proxy * px , struct session * l4 , void * l7 , unsigned int opt , const struct arg * args , struct sample * smp ) { struct server * iterator ; smp -> flags = SMP_F_VOL_TEST ; smp -> type = SMP_T_UINT ; smp -> data . uint = 0 ; for ( iterator = args -> data . prx -> srv ; iterator ; iterator = iterator -> next ) { if ( ( iterator -> state & SRV_RUNNING ) == 0 ) continue ; if ( iterator -> maxconn == 0 || iterator -> maxqueue == 0 ) { smp -> data . uint = -1 ; return 1 ; } smp -> data . uint += ( iterator -> maxconn - iterator -> cur_sess ) + ( iterator -> maxqueue - iterator -> nbpend ) ; } return 1 ; }
set temp integer to the number of enabled servers on the proxy.
set temp integer to the number of enabled servers on the proxy .
/* configuration is stupid */ /* FIXME: stupid value! */