src/dumpstats.c
static void http_stats_io_handler(struct stream_interface *si)
{
	struct session *s = si->conn->xprt_ctx;
	struct channel *req = si->ob;
	struct channel *res = si->ib;

	if (unlikely(si->state == SI_ST_DIS || si->state == SI_ST_CLO))
		goto out;

	/* check that the output is not closed */
	if (res->flags & (CF_SHUTW|CF_SHUTW_NOW))
		si->applet.st0 = 1;

	if (!si->applet.st0) {
		if (stats_dump_stat_to_buffer(si, s->be->uri_auth)) {
			si->applet.st0 = 1;
			si_shutw(si);
		}
	}

	if ((res->flags & CF_SHUTR) && (si->state == SI_ST_EST))
		si_shutw(si);

	if ((req->flags & CF_SHUTW) && (si->state == SI_ST_EST) && si->applet.st0) {
		si_shutr(si);
		res->flags |= CF_READ_NULL;
	}

	/* update all other flags and resync with the other side */
	si_update(si);

	/* we don't want to expire timeouts while we're processing requests */
	si->ib->rex = TICK_ETERNITY;
	si->ob->wex = TICK_ETERNITY;

 out:
	if (unlikely(si->state == SI_ST_DIS || si->state == SI_ST_CLO)) {
		/* check that we have released everything then unregister */
		stream_int_unregister_handler(si);
	}
}
/* This I/O handler runs as an applet embedded in a stream interface. It is
 * used to send HTTP stats over a TCP socket. The mechanism is very simple.
 * si->applet.st0 becomes non-zero once the transfer is finished. The handler
 * automatically unregisters itself once transfer is complete.
 */
This I/O handler runs as an applet embedded in a stream interface. It is
used to send HTTP stats over a TCP socket. The mechanism is very simple.
si->applet.st0 becomes non-zero once the transfer is finished. The handler
automatically unregisters itself once transfer is complete.
This I / O handler runs as an applet embedded in a stream interface . It is used to send HTTP stats over a TCP socket . The mechanism is very simple . si - > applet . st0 becomes non - zero once the transfer is finished . The handler automatically unregisters itself once transfer is complete .
static void http_stats_io_handler(struct stream_interface *si)
{
	struct session *s = si->conn->xprt_ctx;
	struct channel *req = si->ob;
	struct channel *res = si->ib;
	if (unlikely(si->state == SI_ST_DIS || si->state == SI_ST_CLO))
		goto out;
	if (res->flags & (CF_SHUTW|CF_SHUTW_NOW))
		si->applet.st0 = 1;
	if (!si->applet.st0) {
		if (stats_dump_stat_to_buffer(si, s->be->uri_auth)) {
			si->applet.st0 = 1;
			si_shutw(si);
		}
	}
	if ((res->flags & CF_SHUTR) && (si->state == SI_ST_EST))
		si_shutw(si);
	if ((req->flags & CF_SHUTW) && (si->state == SI_ST_EST) && si->applet.st0) {
		si_shutr(si);
		res->flags |= CF_READ_NULL;
	}
	si_update(si);
	si->ib->rex = TICK_ETERNITY;
	si->ob->wex = TICK_ETERNITY;
 out:
	if (unlikely(si->state == SI_ST_DIS || si->state == SI_ST_CLO)) {
		stream_int_unregister_handler(si);
	}
}
static void http_stats_io_handler ( struct stream_interface * si ) { struct session * s = si -> conn -> xprt_ctx ; struct channel * req = si -> ob ; struct channel * res = si -> ib ; if ( unlikely ( si -> state == SI_ST_DIS || si -> state == SI_ST_CLO ) ) goto out ; if ( res -> flags & ( CF_SHUTW | CF_SHUTW_NOW ) ) si -> applet . st0 = 1 ; if ( ! si -> applet . st0 ) { if ( stats_dump_stat_to_buffer ( si , s -> be -> uri_auth ) ) { si -> applet . st0 = 1 ; si_shutw ( si ) ; } } if ( ( res -> flags & CF_SHUTR ) && ( si -> state == SI_ST_EST ) ) si_shutw ( si ) ; if ( ( req -> flags & CF_SHUTW ) && ( si -> state == SI_ST_EST ) && si -> applet . st0 ) { si_shutr ( si ) ; res -> flags |= CF_READ_NULL ; } si_update ( si ) ; si -> ib -> rex = TICK_ETERNITY ; si -> ob -> wex = TICK_ETERNITY ; out : if ( unlikely ( si -> state == SI_ST_DIS || si -> state == SI_ST_CLO ) ) { stream_int_unregister_handler ( si ) ; } }
This I/O handler runs as an applet embedded in a stream interface.
This I / O handler runs as an applet embedded in a stream interface .
/* check that the output is not closed */ /* update all other flags and resync with the other side */ /* we don't want to expire timeouts while we're processing requests */ /* check that we have released everything then unregister */