mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 23:27:04 +02:00
REORG/MEDIUM: stream: rename stream flags from SN_* to SF_*
This is in order to keep things consistent.
This commit is contained in:
parent
87b09668be
commit
e7dff02dd4
@ -103,13 +103,13 @@ static inline int server_is_draining(const struct server *s)
|
||||
}
|
||||
|
||||
/* Shutdown all connections of a server. The caller must pass a termination
|
||||
* code in <why>, which must be one of SN_ERR_* indicating the reason for the
|
||||
* code in <why>, which must be one of SF_ERR_* indicating the reason for the
|
||||
* shutdown.
|
||||
*/
|
||||
void srv_shutdown_sessions(struct server *srv, int why);
|
||||
|
||||
/* Shutdown all connections of all backup servers of a proxy. The caller must
|
||||
* pass a termination code in <why>, which must be one of SN_ERR_* indicating
|
||||
* pass a termination code in <why>, which must be one of SF_ERR_* indicating
|
||||
* the reason for the shutdown.
|
||||
*/
|
||||
void srv_shutdown_backup_sessions(struct proxy *px, int why);
|
||||
|
@ -41,7 +41,7 @@ int stream_accept(struct listener *l, int cfd, struct sockaddr_storage *addr);
|
||||
/* perform minimal intializations, report 0 in case of error, 1 if OK. */
|
||||
int init_stream();
|
||||
|
||||
/* kill a stream and set the termination flags to <why> (one of SN_ERR_*) */
|
||||
/* kill a stream and set the termination flags to <why> (one of SF_ERR_*) */
|
||||
void stream_shutdown(struct stream *stream, int why);
|
||||
|
||||
void stream_process_counters(struct stream *s);
|
||||
|
@ -371,14 +371,14 @@ static inline void si_chk_snd(struct stream_interface *si)
|
||||
static inline int si_connect(struct stream_interface *si)
|
||||
{
|
||||
struct connection *conn = objt_conn(si->end);
|
||||
int ret = SN_ERR_NONE;
|
||||
int ret = SF_ERR_NONE;
|
||||
|
||||
if (unlikely(!conn || !conn->ctrl || !conn->ctrl->connect))
|
||||
return SN_ERR_INTERNAL;
|
||||
return SF_ERR_INTERNAL;
|
||||
|
||||
if (!conn_ctrl_ready(conn) || !conn_xprt_ready(conn)) {
|
||||
ret = conn->ctrl->connect(conn, !channel_is_empty(si_oc(si)), 0);
|
||||
if (ret != SN_ERR_NONE)
|
||||
if (ret != SF_ERR_NONE)
|
||||
return ret;
|
||||
|
||||
/* we need to be notified about connection establishment */
|
||||
|
@ -44,52 +44,52 @@
|
||||
#include <types/stick_table.h>
|
||||
|
||||
|
||||
/* various stream flags, bits values 0x01 to 0x100 (shift 0) */
|
||||
#define SN_DIRECT 0x00000001 /* connection made on the server matching the client cookie */
|
||||
#define SN_ASSIGNED 0x00000002 /* no need to assign a server to this stream */
|
||||
#define SN_ADDR_SET 0x00000004 /* this stream's server address has been set */
|
||||
#define SN_BE_ASSIGNED 0x00000008 /* a backend was assigned. Conns are accounted. */
|
||||
/* Various Stream Flags, bits values 0x01 to 0x100 (shift 0) */
|
||||
#define SF_DIRECT 0x00000001 /* connection made on the server matching the client cookie */
|
||||
#define SF_ASSIGNED 0x00000002 /* no need to assign a server to this stream */
|
||||
#define SF_ADDR_SET 0x00000004 /* this stream's server address has been set */
|
||||
#define SF_BE_ASSIGNED 0x00000008 /* a backend was assigned. Conns are accounted. */
|
||||
|
||||
#define SN_FORCE_PRST 0x00000010 /* force persistence here, even if server is down */
|
||||
#define SN_MONITOR 0x00000020 /* this stream comes from a monitoring system */
|
||||
#define SN_CURR_SESS 0x00000040 /* a connection is currently being counted on the server */
|
||||
#define SN_INITIALIZED 0x00000080 /* the stream was fully initialized */
|
||||
#define SN_REDISP 0x00000100 /* set if this stream was redispatched from one server to another */
|
||||
#define SN_CONN_TAR 0x00000200 /* set if this stream is turning around before reconnecting */
|
||||
#define SN_REDIRECTABLE 0x00000400 /* set if this stream is redirectable (GET or HEAD) */
|
||||
#define SN_TUNNEL 0x00000800 /* tunnel-mode stream, nothing to catch after data */
|
||||
#define SF_FORCE_PRST 0x00000010 /* force persistence here, even if server is down */
|
||||
#define SF_MONITOR 0x00000020 /* this stream comes from a monitoring system */
|
||||
#define SF_CURR_SESS 0x00000040 /* a connection is currently being counted on the server */
|
||||
#define SF_INITIALIZED 0x00000080 /* the stream was fully initialized */
|
||||
#define SF_REDISP 0x00000100 /* set if this stream was redispatched from one server to another */
|
||||
#define SF_CONN_TAR 0x00000200 /* set if this stream is turning around before reconnecting */
|
||||
#define SF_REDIRECTABLE 0x00000400 /* set if this stream is redirectable (GET or HEAD) */
|
||||
#define SF_TUNNEL 0x00000800 /* tunnel-mode stream, nothing to catch after data */
|
||||
|
||||
/* stream termination conditions, bits values 0x1000 to 0x7000 (0-9 shift 12) */
|
||||
#define SN_ERR_NONE 0x00000000 /* normal end of request */
|
||||
#define SN_ERR_LOCAL 0x00001000 /* the proxy locally processed this request => not an error */
|
||||
#define SN_ERR_CLITO 0x00002000 /* client time-out */
|
||||
#define SN_ERR_CLICL 0x00003000 /* client closed (read/write error) */
|
||||
#define SN_ERR_SRVTO 0x00004000 /* server time-out, connect time-out */
|
||||
#define SN_ERR_SRVCL 0x00005000 /* server closed (connect/read/write error) */
|
||||
#define SN_ERR_PRXCOND 0x00006000 /* the proxy decided to close (deny...) */
|
||||
#define SN_ERR_RESOURCE 0x00007000 /* the proxy encountered a lack of a local resources (fd, mem, ...) */
|
||||
#define SN_ERR_INTERNAL 0x00008000 /* the proxy encountered an internal error */
|
||||
#define SN_ERR_DOWN 0x00009000 /* the proxy killed a stream because the backend became unavailable */
|
||||
#define SN_ERR_KILLED 0x0000a000 /* the proxy killed a stream because it was asked to do so */
|
||||
#define SN_ERR_UP 0x0000b000 /* the proxy killed a stream because a preferred backend became available */
|
||||
#define SN_ERR_MASK 0x0000f000 /* mask to get only stream error flags */
|
||||
#define SN_ERR_SHIFT 12 /* bit shift */
|
||||
#define SF_ERR_NONE 0x00000000 /* normal end of request */
|
||||
#define SF_ERR_LOCAL 0x00001000 /* the proxy locally processed this request => not an error */
|
||||
#define SF_ERR_CLITO 0x00002000 /* client time-out */
|
||||
#define SF_ERR_CLICL 0x00003000 /* client closed (read/write error) */
|
||||
#define SF_ERR_SRVTO 0x00004000 /* server time-out, connect time-out */
|
||||
#define SF_ERR_SRVCL 0x00005000 /* server closed (connect/read/write error) */
|
||||
#define SF_ERR_PRXCOND 0x00006000 /* the proxy decided to close (deny...) */
|
||||
#define SF_ERR_RESOURCE 0x00007000 /* the proxy encountered a lack of a local resources (fd, mem, ...) */
|
||||
#define SF_ERR_INTERNAL 0x00008000 /* the proxy encountered an internal error */
|
||||
#define SF_ERR_DOWN 0x00009000 /* the proxy killed a stream because the backend became unavailable */
|
||||
#define SF_ERR_KILLED 0x0000a000 /* the proxy killed a stream because it was asked to do so */
|
||||
#define SF_ERR_UP 0x0000b000 /* the proxy killed a stream because a preferred backend became available */
|
||||
#define SF_ERR_MASK 0x0000f000 /* mask to get only stream error flags */
|
||||
#define SF_ERR_SHIFT 12 /* bit shift */
|
||||
|
||||
/* stream state at termination, bits values 0x10000 to 0x70000 (0-7 shift 16) */
|
||||
#define SN_FINST_R 0x00010000 /* stream ended during client request */
|
||||
#define SN_FINST_C 0x00020000 /* stream ended during server connect */
|
||||
#define SN_FINST_H 0x00030000 /* stream ended during server headers */
|
||||
#define SN_FINST_D 0x00040000 /* stream ended during data phase */
|
||||
#define SN_FINST_L 0x00050000 /* stream ended while pushing last data to client */
|
||||
#define SN_FINST_Q 0x00060000 /* stream ended while waiting in queue for a server slot */
|
||||
#define SN_FINST_T 0x00070000 /* stream ended tarpitted */
|
||||
#define SN_FINST_MASK 0x00070000 /* mask to get only final stream state flags */
|
||||
#define SN_FINST_SHIFT 16 /* bit shift */
|
||||
#define SF_FINST_R 0x00010000 /* stream ended during client request */
|
||||
#define SF_FINST_C 0x00020000 /* stream ended during server connect */
|
||||
#define SF_FINST_H 0x00030000 /* stream ended during server headers */
|
||||
#define SF_FINST_D 0x00040000 /* stream ended during data phase */
|
||||
#define SF_FINST_L 0x00050000 /* stream ended while pushing last data to client */
|
||||
#define SF_FINST_Q 0x00060000 /* stream ended while waiting in queue for a server slot */
|
||||
#define SF_FINST_T 0x00070000 /* stream ended tarpitted */
|
||||
#define SF_FINST_MASK 0x00070000 /* mask to get only final stream state flags */
|
||||
#define SF_FINST_SHIFT 16 /* bit shift */
|
||||
|
||||
#define SN_IGNORE_PRST 0x00080000 /* ignore persistence */
|
||||
#define SF_IGNORE_PRST 0x00080000 /* ignore persistence */
|
||||
|
||||
#define SN_COMP_READY 0x00100000 /* the compression is initialized */
|
||||
#define SN_SRV_REUSED 0x00200000 /* the server-side connection was reused */
|
||||
#define SF_COMP_READY 0x00100000 /* the compression is initialized */
|
||||
#define SF_SRV_REUSED 0x00200000 /* the server-side connection was reused */
|
||||
|
||||
/* some external definitions */
|
||||
struct strm_logs {
|
||||
|
@ -499,7 +499,7 @@ struct server *get_server_rch(struct stream *s)
|
||||
* defined by the backend it is assigned to. The stream is then marked as
|
||||
* 'assigned'.
|
||||
*
|
||||
* This function MAY NOT be called with SN_ASSIGNED already set. If the stream
|
||||
* This function MAY NOT be called with SF_ASSIGNED already set. If the stream
|
||||
* had a server previously assigned, it is rebalanced, trying to avoid the same
|
||||
* server, which should still be present in target_srv(&s->target) before the call.
|
||||
* The function tries to keep the original connection slot if it reconnects to
|
||||
@ -513,7 +513,7 @@ struct server *get_server_rch(struct stream *s)
|
||||
* SRV_STATUS_FULL if all servers are saturated. Stream is not ASSIGNED
|
||||
* SRV_STATUS_INTERNAL for other unrecoverable errors.
|
||||
*
|
||||
* Upon successful return, the stream flag SN_ASSIGNED is set to indicate that
|
||||
* Upon successful return, the stream flag SF_ASSIGNED is set to indicate that
|
||||
* it does not need to be called anymore. This means that target_srv(&s->target)
|
||||
* can be trusted in balance and direct modes.
|
||||
*
|
||||
@ -529,7 +529,7 @@ int assign_server(struct stream *s)
|
||||
DPRINTF(stderr,"assign_server : s=%p\n",s);
|
||||
|
||||
err = SRV_STATUS_INTERNAL;
|
||||
if (unlikely(s->pend_pos || s->flags & SN_ASSIGNED))
|
||||
if (unlikely(s->pend_pos || s->flags & SF_ASSIGNED))
|
||||
goto out_err;
|
||||
|
||||
prev_srv = objt_server(s->target);
|
||||
@ -708,7 +708,7 @@ int assign_server(struct stream *s)
|
||||
goto out;
|
||||
}
|
||||
|
||||
s->flags |= SN_ASSIGNED;
|
||||
s->flags |= SF_ASSIGNED;
|
||||
err = SRV_STATUS_OK;
|
||||
out:
|
||||
|
||||
@ -729,7 +729,7 @@ int assign_server(struct stream *s)
|
||||
}
|
||||
|
||||
/*
|
||||
* This function assigns a server address to a stream, and sets SN_ADDR_SET.
|
||||
* This function assigns a server address to a stream, and sets SF_ADDR_SET.
|
||||
* The address is taken from the currently assigned server, or from the
|
||||
* dispatch or transparent address.
|
||||
*
|
||||
@ -737,7 +737,7 @@ int assign_server(struct stream *s)
|
||||
* SRV_STATUS_OK if everything is OK.
|
||||
* SRV_STATUS_INTERNAL for other unrecoverable errors.
|
||||
*
|
||||
* Upon successful return, the stream flag SN_ADDR_SET is set. This flag is
|
||||
* Upon successful return, the stream flag SF_ADDR_SET is set. This flag is
|
||||
* not cleared, so it's to the caller to clear it if required.
|
||||
*
|
||||
* The caller is responsible for having already assigned a connection
|
||||
@ -753,9 +753,9 @@ int assign_server_address(struct stream *s)
|
||||
fprintf(stderr,"assign_server_address : s=%p\n",s);
|
||||
#endif
|
||||
|
||||
if ((s->flags & SN_DIRECT) || (s->be->lbprm.algo & BE_LB_KIND)) {
|
||||
if ((s->flags & SF_DIRECT) || (s->be->lbprm.algo & BE_LB_KIND)) {
|
||||
/* A server is necessarily known for this stream */
|
||||
if (!(s->flags & SN_ASSIGNED))
|
||||
if (!(s->flags & SF_ASSIGNED))
|
||||
return SRV_STATUS_INTERNAL;
|
||||
|
||||
srv_conn->addr.to = objt_server(s->target)->addr;
|
||||
@ -813,14 +813,14 @@ int assign_server_address(struct stream *s)
|
||||
/* Copy network namespace from client connection */
|
||||
srv_conn->proxy_netns = cli_conn ? cli_conn->proxy_netns : NULL;
|
||||
|
||||
s->flags |= SN_ADDR_SET;
|
||||
s->flags |= SF_ADDR_SET;
|
||||
return SRV_STATUS_OK;
|
||||
}
|
||||
|
||||
/* This function assigns a server to stream <s> if required, and can add the
|
||||
* connection to either the assigned server's queue or to the proxy's queue.
|
||||
* If ->srv_conn is set, the stream is first released from the server.
|
||||
* It may also be called with SN_DIRECT and/or SN_ASSIGNED though. It will
|
||||
* It may also be called with SF_DIRECT and/or SF_ASSIGNED though. It will
|
||||
* be called before any connection and after any retry or redispatch occurs.
|
||||
*
|
||||
* It is not allowed to call this function with a stream in a queue.
|
||||
@ -846,7 +846,7 @@ int assign_server_and_queue(struct stream *s)
|
||||
return SRV_STATUS_INTERNAL;
|
||||
|
||||
err = SRV_STATUS_OK;
|
||||
if (!(s->flags & SN_ASSIGNED)) {
|
||||
if (!(s->flags & SF_ASSIGNED)) {
|
||||
struct server *prev_srv = objt_server(s->target);
|
||||
|
||||
err = assign_server(s);
|
||||
@ -855,7 +855,7 @@ int assign_server_and_queue(struct stream *s)
|
||||
* update the stream's and the server's stats :
|
||||
* - if the server changed :
|
||||
* - set TX_CK_DOWN if txn.flags was TX_CK_VALID
|
||||
* - set SN_REDISP if it was successfully redispatched
|
||||
* - set SF_REDISP if it was successfully redispatched
|
||||
* - increment srv->redispatches and be->redispatches
|
||||
* - if the server remained the same : update retries.
|
||||
*/
|
||||
@ -865,7 +865,7 @@ int assign_server_and_queue(struct stream *s)
|
||||
s->txn.flags &= ~TX_CK_MASK;
|
||||
s->txn.flags |= TX_CK_DOWN;
|
||||
}
|
||||
s->flags |= SN_REDISP;
|
||||
s->flags |= SF_REDISP;
|
||||
prev_srv->counters.redispatches++;
|
||||
s->be->be_counters.redispatches++;
|
||||
} else {
|
||||
@ -877,7 +877,7 @@ int assign_server_and_queue(struct stream *s)
|
||||
|
||||
switch (err) {
|
||||
case SRV_STATUS_OK:
|
||||
/* we have SN_ASSIGNED set */
|
||||
/* we have SF_ASSIGNED set */
|
||||
srv = objt_server(s->target);
|
||||
if (!srv)
|
||||
return SRV_STATUS_OK; /* dispatch or proxy mode */
|
||||
@ -890,7 +890,7 @@ int assign_server_and_queue(struct stream *s)
|
||||
* connection slot yet. Either it is a redispatch, or it was
|
||||
* assigned from persistence information (direct mode).
|
||||
*/
|
||||
if ((s->flags & SN_REDIRECTABLE) && srv->rdr_len) {
|
||||
if ((s->flags & SF_REDIRECTABLE) && srv->rdr_len) {
|
||||
/* server scheduled for redirection, and already assigned. We
|
||||
* don't want to go further nor check the queue.
|
||||
*/
|
||||
@ -1004,13 +1004,13 @@ static void assign_tproxy_address(struct stream *s)
|
||||
* (s->target, s->si[1].addr.to). It will assign a server if none
|
||||
* is assigned yet.
|
||||
* It can return one of :
|
||||
* - SN_ERR_NONE if everything's OK
|
||||
* - SN_ERR_SRVTO if there are no more servers
|
||||
* - SN_ERR_SRVCL if the connection was refused by the server
|
||||
* - SN_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
|
||||
* - SN_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
|
||||
* - SN_ERR_INTERNAL for any other purely internal errors
|
||||
* Additionnally, in the case of SN_ERR_RESOURCE, an emergency log will be emitted.
|
||||
* - SF_ERR_NONE if everything's OK
|
||||
* - SF_ERR_SRVTO if there are no more servers
|
||||
* - SF_ERR_SRVCL if the connection was refused by the server
|
||||
* - SF_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
|
||||
* - SF_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
|
||||
* - SF_ERR_INTERNAL for any other purely internal errors
|
||||
* Additionnally, in the case of SF_ERR_RESOURCE, an emergency log will be emitted.
|
||||
* The server-facing stream interface is expected to hold a pre-allocated connection
|
||||
* in s->si[1].conn.
|
||||
*/
|
||||
@ -1045,12 +1045,12 @@ int connect_server(struct stream *s)
|
||||
|
||||
srv_conn = si_alloc_conn(&s->si[1], reuse);
|
||||
if (!srv_conn)
|
||||
return SN_ERR_RESOURCE;
|
||||
return SF_ERR_RESOURCE;
|
||||
|
||||
if (!(s->flags & SN_ADDR_SET)) {
|
||||
if (!(s->flags & SF_ADDR_SET)) {
|
||||
err = assign_server_address(s);
|
||||
if (err != SRV_STATUS_OK)
|
||||
return SN_ERR_INTERNAL;
|
||||
return SF_ERR_INTERNAL;
|
||||
}
|
||||
|
||||
if (!conn_xprt_ready(srv_conn)) {
|
||||
@ -1065,10 +1065,10 @@ int connect_server(struct stream *s)
|
||||
/* proxies exclusively run on raw_sock right now */
|
||||
conn_prepare(srv_conn, protocol_by_family(srv_conn->addr.to.ss_family), &raw_sock);
|
||||
if (!objt_conn(s->si[1].end) || !objt_conn(s->si[1].end)->ctrl)
|
||||
return SN_ERR_INTERNAL;
|
||||
return SF_ERR_INTERNAL;
|
||||
}
|
||||
else
|
||||
return SN_ERR_INTERNAL; /* how did we get there ? */
|
||||
return SF_ERR_INTERNAL; /* how did we get there ? */
|
||||
|
||||
/* process the case where the server requires the PROXY protocol to be sent */
|
||||
srv_conn->send_proxy_ofs = 0;
|
||||
@ -1086,7 +1086,7 @@ int connect_server(struct stream *s)
|
||||
else {
|
||||
/* the connection is being reused, just re-attach it */
|
||||
si_attach_conn(&s->si[1], srv_conn);
|
||||
s->flags |= SN_SRV_REUSED;
|
||||
s->flags |= SF_SRV_REUSED;
|
||||
}
|
||||
|
||||
/* flag for logging source ip/port */
|
||||
@ -1099,7 +1099,7 @@ int connect_server(struct stream *s)
|
||||
|
||||
err = si_connect(&s->si[1]);
|
||||
|
||||
if (err != SN_ERR_NONE)
|
||||
if (err != SF_ERR_NONE)
|
||||
return err;
|
||||
|
||||
/* set connect timeout */
|
||||
@ -1107,7 +1107,7 @@ int connect_server(struct stream *s)
|
||||
|
||||
srv = objt_server(s->target);
|
||||
if (srv) {
|
||||
s->flags |= SN_CURR_SESS;
|
||||
s->flags |= SF_CURR_SESS;
|
||||
srv->cur_sess++;
|
||||
if (srv->cur_sess > srv->counters.cur_sess_max)
|
||||
srv->counters.cur_sess_max = srv->cur_sess;
|
||||
@ -1115,7 +1115,7 @@ int connect_server(struct stream *s)
|
||||
s->be->lbprm.server_take_conn(srv);
|
||||
}
|
||||
|
||||
return SN_ERR_NONE; /* connection is OK */
|
||||
return SF_ERR_NONE; /* connection is OK */
|
||||
}
|
||||
|
||||
|
||||
@ -1151,9 +1151,9 @@ int srv_redispatch_connect(struct stream *s)
|
||||
* would bring us on the same server again. Note that s->target is set
|
||||
* in this case.
|
||||
*/
|
||||
if (((s->flags & (SN_DIRECT|SN_FORCE_PRST)) == SN_DIRECT) &&
|
||||
if (((s->flags & (SF_DIRECT|SF_FORCE_PRST)) == SF_DIRECT) &&
|
||||
(s->be->options & PR_O_REDISP)) {
|
||||
s->flags &= ~(SN_DIRECT | SN_ASSIGNED | SN_ADDR_SET);
|
||||
s->flags &= ~(SF_DIRECT | SF_ASSIGNED | SF_ADDR_SET);
|
||||
goto redispatch;
|
||||
}
|
||||
|
||||
@ -1241,7 +1241,7 @@ int tcp_persist_rdp_cookie(struct stream *s, struct channel *req, int an_bit)
|
||||
req->buf->i,
|
||||
req->analysers);
|
||||
|
||||
if (s->flags & SN_ASSIGNED)
|
||||
if (s->flags & SF_ASSIGNED)
|
||||
goto no_cookie;
|
||||
|
||||
memset(&smp, 0, sizeof(smp));
|
||||
@ -1268,7 +1268,7 @@ int tcp_persist_rdp_cookie(struct stream *s, struct channel *req, int an_bit)
|
||||
memcmp(&addr, &(srv->addr), sizeof(addr)) == 0) {
|
||||
if ((srv->state != SRV_ST_STOPPED) || (px->options & PR_O_PERSIST)) {
|
||||
/* we found the server and it is usable */
|
||||
s->flags |= SN_DIRECT | SN_ASSIGNED;
|
||||
s->flags |= SF_DIRECT | SF_ASSIGNED;
|
||||
s->target = &srv->obj_type;
|
||||
break;
|
||||
}
|
||||
|
94
src/checks.c
94
src/checks.c
@ -1389,14 +1389,14 @@ static struct task *server_warmup(struct task *t)
|
||||
* establish a server health-check that makes use of a connection.
|
||||
*
|
||||
* It can return one of :
|
||||
* - SN_ERR_NONE if everything's OK and tcpcheck_main() was not called
|
||||
* - SN_ERR_UP if if everything's OK and tcpcheck_main() was called
|
||||
* - SN_ERR_SRVTO if there are no more servers
|
||||
* - SN_ERR_SRVCL if the connection was refused by the server
|
||||
* - SN_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
|
||||
* - SN_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
|
||||
* - SN_ERR_INTERNAL for any other purely internal errors
|
||||
* Additionnally, in the case of SN_ERR_RESOURCE, an emergency log will be emitted.
|
||||
* - SF_ERR_NONE if everything's OK and tcpcheck_main() was not called
|
||||
* - SF_ERR_UP if if everything's OK and tcpcheck_main() was called
|
||||
* - SF_ERR_SRVTO if there are no more servers
|
||||
* - SF_ERR_SRVCL if the connection was refused by the server
|
||||
* - SF_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
|
||||
* - SF_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
|
||||
* - SF_ERR_INTERNAL for any other purely internal errors
|
||||
* Additionnally, in the case of SF_ERR_RESOURCE, an emergency log will be emitted.
|
||||
* Note that we try to prevent the network stack from sending the ACK during the
|
||||
* connect() when a pure TCP check is used (without PROXY protocol).
|
||||
*/
|
||||
@ -1474,13 +1474,13 @@ static int connect_conn_chk(struct task *t)
|
||||
/* if first step is a 'connect', then tcpcheck_main must run it */
|
||||
if (r->action == TCPCHK_ACT_CONNECT) {
|
||||
tcpcheck_main(conn);
|
||||
return SN_ERR_UP;
|
||||
return SF_ERR_UP;
|
||||
}
|
||||
if (r->action == TCPCHK_ACT_EXPECT)
|
||||
quickack = 0;
|
||||
}
|
||||
|
||||
ret = SN_ERR_INTERNAL;
|
||||
ret = SF_ERR_INTERNAL;
|
||||
if (proto->connect)
|
||||
ret = proto->connect(conn, check->type, quickack ? 2 : 0);
|
||||
conn->flags |= CO_FL_WAKE_DATA;
|
||||
@ -1763,13 +1763,13 @@ static int prepare_external_check(struct check *check)
|
||||
* establish a server health-check that makes use of a process.
|
||||
*
|
||||
* It can return one of :
|
||||
* - SN_ERR_NONE if everything's OK
|
||||
* - SN_ERR_SRVTO if there are no more servers
|
||||
* - SN_ERR_SRVCL if the connection was refused by the server
|
||||
* - SN_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
|
||||
* - SN_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
|
||||
* - SN_ERR_INTERNAL for any other purely internal errors
|
||||
* Additionnally, in the case of SN_ERR_RESOURCE, an emergency log will be emitted.
|
||||
* - SF_ERR_NONE if everything's OK
|
||||
* - SF_ERR_SRVTO if there are no more servers
|
||||
* - SF_ERR_SRVCL if the connection was refused by the server
|
||||
* - SF_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
|
||||
* - SF_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
|
||||
* - SF_ERR_INTERNAL for any other purely internal errors
|
||||
* Additionnally, in the case of SF_ERR_RESOURCE, an emergency log will be emitted.
|
||||
*
|
||||
* Blocks and then unblocks SIGCHLD
|
||||
*/
|
||||
@ -1782,7 +1782,7 @@ static int connect_proc_chk(struct task *t)
|
||||
int status;
|
||||
pid_t pid;
|
||||
|
||||
status = SN_ERR_RESOURCE;
|
||||
status = SF_ERR_RESOURCE;
|
||||
|
||||
block_sigchld();
|
||||
|
||||
@ -1813,7 +1813,7 @@ static int connect_proc_chk(struct task *t)
|
||||
int t_con = tick_add(now_ms, px->timeout.connect);
|
||||
t->expire = tick_first(t->expire, t_con);
|
||||
}
|
||||
status = SN_ERR_NONE;
|
||||
status = SF_ERR_NONE;
|
||||
goto out;
|
||||
}
|
||||
else {
|
||||
@ -1862,9 +1862,9 @@ static struct task *process_chk_proc(struct task *t)
|
||||
|
||||
ret = connect_proc_chk(t);
|
||||
switch (ret) {
|
||||
case SN_ERR_UP:
|
||||
case SF_ERR_UP:
|
||||
return t;
|
||||
case SN_ERR_NONE:
|
||||
case SF_ERR_NONE:
|
||||
/* we allow up to min(inter, timeout.connect) for a connection
|
||||
* to establish but only when timeout.check is set
|
||||
* as it may be to short for a full check otherwise
|
||||
@ -1878,14 +1878,14 @@ static struct task *process_chk_proc(struct task *t)
|
||||
|
||||
goto reschedule;
|
||||
|
||||
case SN_ERR_SRVTO: /* ETIMEDOUT */
|
||||
case SN_ERR_SRVCL: /* ECONNREFUSED, ENETUNREACH, ... */
|
||||
case SF_ERR_SRVTO: /* ETIMEDOUT */
|
||||
case SF_ERR_SRVCL: /* ECONNREFUSED, ENETUNREACH, ... */
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
chk_report_conn_err(conn, errno, 0);
|
||||
break;
|
||||
case SN_ERR_PRXCOND:
|
||||
case SN_ERR_RESOURCE:
|
||||
case SN_ERR_INTERNAL:
|
||||
case SF_ERR_PRXCOND:
|
||||
case SF_ERR_RESOURCE:
|
||||
case SF_ERR_INTERNAL:
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
chk_report_conn_err(conn, 0, 0);
|
||||
break;
|
||||
@ -2005,9 +2005,9 @@ static struct task *process_chk_conn(struct task *t)
|
||||
|
||||
ret = connect_conn_chk(t);
|
||||
switch (ret) {
|
||||
case SN_ERR_UP:
|
||||
case SF_ERR_UP:
|
||||
return t;
|
||||
case SN_ERR_NONE:
|
||||
case SF_ERR_NONE:
|
||||
/* we allow up to min(inter, timeout.connect) for a connection
|
||||
* to establish but only when timeout.check is set
|
||||
* as it may be to short for a full check otherwise
|
||||
@ -2024,14 +2024,14 @@ static struct task *process_chk_conn(struct task *t)
|
||||
|
||||
goto reschedule;
|
||||
|
||||
case SN_ERR_SRVTO: /* ETIMEDOUT */
|
||||
case SN_ERR_SRVCL: /* ECONNREFUSED, ENETUNREACH, ... */
|
||||
case SF_ERR_SRVTO: /* ETIMEDOUT */
|
||||
case SF_ERR_SRVCL: /* ECONNREFUSED, ENETUNREACH, ... */
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
chk_report_conn_err(conn, errno, 0);
|
||||
break;
|
||||
case SN_ERR_PRXCOND:
|
||||
case SN_ERR_RESOURCE:
|
||||
case SN_ERR_INTERNAL:
|
||||
case SF_ERR_PRXCOND:
|
||||
case SF_ERR_RESOURCE:
|
||||
case SF_ERR_INTERNAL:
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
chk_report_conn_err(conn, 0, 0);
|
||||
break;
|
||||
@ -2532,7 +2532,7 @@ static void tcpcheck_main(struct connection *conn)
|
||||
#endif /* USE_OPENSSL */
|
||||
conn_prepare(conn, proto, xprt);
|
||||
|
||||
ret = SN_ERR_INTERNAL;
|
||||
ret = SF_ERR_INTERNAL;
|
||||
if (proto->connect)
|
||||
ret = proto->connect(conn,
|
||||
1 /* I/O polling is always needed */,
|
||||
@ -2544,18 +2544,18 @@ static void tcpcheck_main(struct connection *conn)
|
||||
}
|
||||
|
||||
/* It can return one of :
|
||||
* - SN_ERR_NONE if everything's OK
|
||||
* - SN_ERR_SRVTO if there are no more servers
|
||||
* - SN_ERR_SRVCL if the connection was refused by the server
|
||||
* - SN_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
|
||||
* - SN_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
|
||||
* - SN_ERR_INTERNAL for any other purely internal errors
|
||||
* Additionnally, in the case of SN_ERR_RESOURCE, an emergency log will be emitted.
|
||||
* - SF_ERR_NONE if everything's OK
|
||||
* - SF_ERR_SRVTO if there are no more servers
|
||||
* - SF_ERR_SRVCL if the connection was refused by the server
|
||||
* - SF_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
|
||||
* - SF_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
|
||||
* - SF_ERR_INTERNAL for any other purely internal errors
|
||||
* Additionnally, in the case of SF_ERR_RESOURCE, an emergency log will be emitted.
|
||||
* Note that we try to prevent the network stack from sending the ACK during the
|
||||
* connect() when a pure TCP check is used (without PROXY protocol).
|
||||
*/
|
||||
switch (ret) {
|
||||
case SN_ERR_NONE:
|
||||
case SF_ERR_NONE:
|
||||
/* we allow up to min(inter, timeout.connect) for a connection
|
||||
* to establish but only when timeout.check is set
|
||||
* as it may be to short for a full check otherwise
|
||||
@ -2567,15 +2567,15 @@ static void tcpcheck_main(struct connection *conn)
|
||||
t->expire = tick_first(t->expire, t_con);
|
||||
}
|
||||
break;
|
||||
case SN_ERR_SRVTO: /* ETIMEDOUT */
|
||||
case SN_ERR_SRVCL: /* ECONNREFUSED, ENETUNREACH, ... */
|
||||
case SF_ERR_SRVTO: /* ETIMEDOUT */
|
||||
case SF_ERR_SRVCL: /* ECONNREFUSED, ENETUNREACH, ... */
|
||||
chunk_printf(&trash, "TCPCHK error establishing connection at step %d: %s",
|
||||
tcpcheck_get_step_id(check), strerror(errno));
|
||||
set_server_check_status(check, HCHK_STATUS_L4CON, trash.str);
|
||||
goto out_end_tcpcheck;
|
||||
case SN_ERR_PRXCOND:
|
||||
case SN_ERR_RESOURCE:
|
||||
case SN_ERR_INTERNAL:
|
||||
case SF_ERR_PRXCOND:
|
||||
case SF_ERR_RESOURCE:
|
||||
case SF_ERR_INTERNAL:
|
||||
chunk_printf(&trash, "TCPCHK error establishing connection at step %d",
|
||||
tcpcheck_get_step_id(check));
|
||||
set_server_check_status(check, HCHK_STATUS_SOCKERR, trash.str);
|
||||
|
@ -2008,7 +2008,7 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
|
||||
return 1;
|
||||
}
|
||||
|
||||
stream_shutdown(sess, SN_ERR_KILLED);
|
||||
stream_shutdown(sess, SF_ERR_KILLED);
|
||||
return 1;
|
||||
}
|
||||
else if (strcmp(args[1], "sessions") == 0) {
|
||||
@ -2023,7 +2023,7 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
|
||||
/* kill all the stream that are on this server */
|
||||
list_for_each_entry_safe(sess, sess_bck, &sv->actconns, by_srv)
|
||||
if (sess->srv_conn == sv)
|
||||
stream_shutdown(sess, SN_ERR_KILLED);
|
||||
stream_shutdown(sess, SF_ERR_KILLED);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -4674,7 +4674,7 @@ static int stats_process_http_post(struct stream_interface *si)
|
||||
|
||||
list_for_each_entry_safe(sess, sess_bck, &sv->actconns, by_srv)
|
||||
if (sess->srv_conn == sv)
|
||||
stream_shutdown(sess, SN_ERR_KILLED);
|
||||
stream_shutdown(sess, SF_ERR_KILLED);
|
||||
|
||||
altered_servers++;
|
||||
total_servers++;
|
||||
|
@ -1351,7 +1351,7 @@ __LJMP static int hlua_socket_gc(lua_State *L)
|
||||
|
||||
/* Remove all reference between the Lua stack and the coroutine stream. */
|
||||
appctx = objt_appctx(socket->s->si[0].end);
|
||||
stream_shutdown(socket->s, SN_ERR_KILLED);
|
||||
stream_shutdown(socket->s, SF_ERR_KILLED);
|
||||
socket->s = NULL;
|
||||
appctx->ctx.hlua.socket = NULL;
|
||||
|
||||
@ -1373,7 +1373,7 @@ __LJMP static int hlua_socket_close(lua_State *L)
|
||||
return 0;
|
||||
|
||||
/* Close the stream and remove the associated stop task. */
|
||||
stream_shutdown(socket->s, SN_ERR_KILLED);
|
||||
stream_shutdown(socket->s, SF_ERR_KILLED);
|
||||
appctx = objt_appctx(socket->s->si[0].end);
|
||||
appctx->ctx.hlua.socket = NULL;
|
||||
socket->s = NULL;
|
||||
@ -2204,7 +2204,7 @@ __LJMP static int hlua_socket_new(lua_State *L)
|
||||
socket->s->si[1].conn_retries = socket_proxy.conn_retries;
|
||||
|
||||
/* Force destination server. */
|
||||
socket->s->flags |= SN_DIRECT | SN_ASSIGNED | SN_ADDR_SET | SN_BE_ASSIGNED;
|
||||
socket->s->flags |= SF_DIRECT | SF_ASSIGNED | SF_ADDR_SET | SF_BE_ASSIGNED;
|
||||
socket->s->target = &socket_tcp.obj_type;
|
||||
|
||||
/* This stream is added to te lists of alive streams. */
|
||||
|
16
src/log.c
16
src/log.c
@ -1335,15 +1335,15 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
|
||||
break;
|
||||
|
||||
case LOG_FMT_TERMSTATE: // %ts
|
||||
LOGCHAR(sess_term_cond[(s->flags & SN_ERR_MASK) >> SN_ERR_SHIFT]);
|
||||
LOGCHAR(sess_fin_state[(s->flags & SN_FINST_MASK) >> SN_FINST_SHIFT]);
|
||||
LOGCHAR(sess_term_cond[(s->flags & SF_ERR_MASK) >> SF_ERR_SHIFT]);
|
||||
LOGCHAR(sess_fin_state[(s->flags & SF_FINST_MASK) >> SF_FINST_SHIFT]);
|
||||
*tmplog = '\0';
|
||||
last_isspace = 0;
|
||||
break;
|
||||
|
||||
case LOG_FMT_TERMSTATE_CK: // %tsc, same as TS with cookie state (for mode HTTP)
|
||||
LOGCHAR(sess_term_cond[(s->flags & SN_ERR_MASK) >> SN_ERR_SHIFT]);
|
||||
LOGCHAR(sess_fin_state[(s->flags & SN_FINST_MASK) >> SN_FINST_SHIFT]);
|
||||
LOGCHAR(sess_term_cond[(s->flags & SF_ERR_MASK) >> SF_ERR_SHIFT]);
|
||||
LOGCHAR(sess_fin_state[(s->flags & SF_FINST_MASK) >> SF_FINST_SHIFT]);
|
||||
LOGCHAR((be->ck_opts & PR_CK_ANY) ? sess_cookie[(txn->flags & TX_CK_MASK) >> TX_CK_SHIFT] : '-');
|
||||
LOGCHAR((be->ck_opts & PR_CK_ANY) ? sess_set_cookie[(txn->flags & TX_SCK_MASK) >> TX_SCK_SHIFT] : '-');
|
||||
last_isspace = 0;
|
||||
@ -1384,7 +1384,7 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
|
||||
break;
|
||||
|
||||
case LOG_FMT_RETRIES: // %rq
|
||||
if (s->flags & SN_REDISP)
|
||||
if (s->flags & SF_REDISP)
|
||||
LOGCHAR('+');
|
||||
ret = ltoa_o((s->si[1].conn_retries>0) ?
|
||||
(be->conn_retries - s->si[1].conn_retries) :
|
||||
@ -1608,9 +1608,9 @@ void strm_log(struct stream *s)
|
||||
int size, err, level;
|
||||
|
||||
/* if we don't want to log normal traffic, return now */
|
||||
err = (s->flags & SN_REDISP) ||
|
||||
((s->flags & SN_ERR_MASK) > SN_ERR_LOCAL) ||
|
||||
(((s->flags & SN_ERR_MASK) == SN_ERR_NONE) &&
|
||||
err = (s->flags & SF_REDISP) ||
|
||||
((s->flags & SF_ERR_MASK) > SF_ERR_LOCAL) ||
|
||||
(((s->flags & SF_ERR_MASK) == SF_ERR_NONE) &&
|
||||
(s->si[1].conn_retries != s->be->conn_retries)) ||
|
||||
((s->fe->mode == PR_MODE_HTTP) && s->txn.status >= 500);
|
||||
|
||||
|
@ -1125,7 +1125,7 @@ static struct stream *peer_session_create(struct peer *peer, struct peer_session
|
||||
LIST_INIT(&s->back_refs);
|
||||
LIST_INIT(&s->buffer_wait);
|
||||
|
||||
s->flags = SN_ASSIGNED|SN_ADDR_SET;
|
||||
s->flags = SF_ASSIGNED|SF_ADDR_SET;
|
||||
|
||||
/* if this session comes from a known monitoring system, we want to ignore
|
||||
* it as soon as possible, which means closing it immediately for TCP.
|
||||
|
304
src/proto_http.c
304
src/proto_http.c
@ -836,9 +836,9 @@ static void http_server_error(struct stream *s, struct stream_interface *si,
|
||||
s->txn.status = status;
|
||||
bo_inject(si_ic(si), msg->str, msg->len);
|
||||
}
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= err;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= finst;
|
||||
}
|
||||
|
||||
@ -1032,7 +1032,7 @@ void http_perform_server_redirect(struct stream *s, struct stream_interface *si)
|
||||
si->state = SI_ST_CLO;
|
||||
|
||||
/* send the message */
|
||||
http_server_error(s, si, SN_ERR_LOCAL, SN_FINST_C, 302, &trash);
|
||||
http_server_error(s, si, SF_ERR_LOCAL, SF_FINST_C, 302, &trash);
|
||||
|
||||
/* FIXME: we should increase a counter of redirects per server and per backend. */
|
||||
srv_inc_sess_ctr(srv);
|
||||
@ -1055,32 +1055,32 @@ void http_return_srv_error(struct stream *s, struct stream_interface *si)
|
||||
int err_type = si->err_type;
|
||||
|
||||
if (err_type & SI_ET_QUEUE_ABRT)
|
||||
http_server_error(s, si, SN_ERR_CLICL, SN_FINST_Q,
|
||||
http_server_error(s, si, SF_ERR_CLICL, SF_FINST_Q,
|
||||
503, http_error_message(s, HTTP_ERR_503));
|
||||
else if (err_type & SI_ET_CONN_ABRT)
|
||||
http_server_error(s, si, SN_ERR_CLICL, SN_FINST_C,
|
||||
http_server_error(s, si, SF_ERR_CLICL, SF_FINST_C,
|
||||
503, (s->txn.flags & TX_NOT_FIRST) ? NULL :
|
||||
http_error_message(s, HTTP_ERR_503));
|
||||
else if (err_type & SI_ET_QUEUE_TO)
|
||||
http_server_error(s, si, SN_ERR_SRVTO, SN_FINST_Q,
|
||||
http_server_error(s, si, SF_ERR_SRVTO, SF_FINST_Q,
|
||||
503, http_error_message(s, HTTP_ERR_503));
|
||||
else if (err_type & SI_ET_QUEUE_ERR)
|
||||
http_server_error(s, si, SN_ERR_SRVCL, SN_FINST_Q,
|
||||
http_server_error(s, si, SF_ERR_SRVCL, SF_FINST_Q,
|
||||
503, http_error_message(s, HTTP_ERR_503));
|
||||
else if (err_type & SI_ET_CONN_TO)
|
||||
http_server_error(s, si, SN_ERR_SRVTO, SN_FINST_C,
|
||||
http_server_error(s, si, SF_ERR_SRVTO, SF_FINST_C,
|
||||
503, (s->txn.flags & TX_NOT_FIRST) ? NULL :
|
||||
http_error_message(s, HTTP_ERR_503));
|
||||
else if (err_type & SI_ET_CONN_ERR)
|
||||
http_server_error(s, si, SN_ERR_SRVCL, SN_FINST_C,
|
||||
503, (s->flags & SN_SRV_REUSED) ? NULL :
|
||||
http_server_error(s, si, SF_ERR_SRVCL, SF_FINST_C,
|
||||
503, (s->flags & SF_SRV_REUSED) ? NULL :
|
||||
http_error_message(s, HTTP_ERR_503));
|
||||
else if (err_type & SI_ET_CONN_RES)
|
||||
http_server_error(s, si, SN_ERR_RESOURCE, SN_FINST_C,
|
||||
http_server_error(s, si, SF_ERR_RESOURCE, SF_FINST_C,
|
||||
503, (s->txn.flags & TX_NOT_FIRST) ? NULL :
|
||||
http_error_message(s, HTTP_ERR_503));
|
||||
else /* SI_ET_CONN_OTHER and others */
|
||||
http_server_error(s, si, SN_ERR_INTERNAL, SN_FINST_C,
|
||||
http_server_error(s, si, SF_ERR_INTERNAL, SF_FINST_C,
|
||||
500, http_error_message(s, HTTP_ERR_500));
|
||||
}
|
||||
|
||||
@ -2428,7 +2428,7 @@ int select_compression_response_header(struct stream *s, struct buffer *res)
|
||||
if (s->comp_algo->init(&s->comp_ctx, global.tune.comp_maxlevel) < 0)
|
||||
goto fail;
|
||||
|
||||
s->flags |= SN_COMP_READY;
|
||||
s->flags |= SF_COMP_READY;
|
||||
|
||||
/* remove Content-Length header */
|
||||
ctx.idx = 0;
|
||||
@ -2539,7 +2539,7 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
||||
* msg->next = first non-visited byte
|
||||
*
|
||||
* At end of parsing, we may perform a capture of the error (if any), and
|
||||
* we will set a few fields (txn->meth, sn->flags/SN_REDIRECTABLE).
|
||||
* we will set a few fields (txn->meth, sn->flags/SF_REDIRECTABLE).
|
||||
* We also check for monitor-uri, logging, HTTP/0.9 to 1.0 conversion, and
|
||||
* finally headers capture.
|
||||
*/
|
||||
@ -2682,8 +2682,8 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
||||
|
||||
/* 2: have we encountered a read error ? */
|
||||
else if (req->flags & CF_READ_ERROR) {
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_CLICL;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_CLICL;
|
||||
|
||||
if (txn->flags & TX_WAIT_NEXT_RQ)
|
||||
goto failed_keep_alive;
|
||||
@ -2705,15 +2705,15 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
||||
if (s->listener->counters)
|
||||
s->listener->counters->failed_req++;
|
||||
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_R;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_R;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 3: has the read timeout expired ? */
|
||||
else if (req->flags & CF_READ_TIMEOUT || tick_is_expired(req->analyse_exp, now_ms)) {
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_CLITO;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_CLITO;
|
||||
|
||||
if (txn->flags & TX_WAIT_NEXT_RQ)
|
||||
goto failed_keep_alive;
|
||||
@ -2734,15 +2734,15 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
||||
if (s->listener->counters)
|
||||
s->listener->counters->failed_req++;
|
||||
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_R;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_R;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 4: have we encountered a close ? */
|
||||
else if (req->flags & CF_SHUTR) {
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_CLICL;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_CLICL;
|
||||
|
||||
if (txn->flags & TX_WAIT_NEXT_RQ)
|
||||
goto failed_keep_alive;
|
||||
@ -2761,8 +2761,8 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
||||
if (s->listener->counters)
|
||||
s->listener->counters->failed_req++;
|
||||
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_R;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_R;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2849,7 +2849,7 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
||||
|
||||
/* we can make use of server redirect on GET and HEAD */
|
||||
if (txn->meth == HTTP_METH_GET || txn->meth == HTTP_METH_HEAD)
|
||||
s->flags |= SN_REDIRECTABLE;
|
||||
s->flags |= SF_REDIRECTABLE;
|
||||
|
||||
/*
|
||||
* 2: check if the URI matches the monitor_uri.
|
||||
@ -2866,7 +2866,7 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
||||
*/
|
||||
struct acl_cond *cond;
|
||||
|
||||
s->flags |= SN_MONITOR;
|
||||
s->flags |= SF_MONITOR;
|
||||
s->fe->fe_counters.intercepted_req++;
|
||||
|
||||
/* Check if we want to fail this monitor request or not */
|
||||
@ -2881,8 +2881,8 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
||||
/* we fail this request, let's return 503 service unavail */
|
||||
txn->status = 503;
|
||||
stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_503));
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_LOCAL; /* we don't want a real error here */
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_LOCAL; /* we don't want a real error here */
|
||||
goto return_prx_cond;
|
||||
}
|
||||
}
|
||||
@ -2890,8 +2890,8 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
||||
/* nothing to fail, let's reply normaly */
|
||||
txn->status = 200;
|
||||
stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_200));
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_LOCAL; /* we don't want a real error here */
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_LOCAL; /* we don't want a real error here */
|
||||
goto return_prx_cond;
|
||||
}
|
||||
|
||||
@ -3075,10 +3075,10 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
||||
s->listener->counters->failed_req++;
|
||||
|
||||
return_prx_cond:
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_PRXCOND;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_R;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_PRXCOND;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_R;
|
||||
|
||||
req->analysers = 0;
|
||||
req->analyse_exp = TICK_ETERNITY;
|
||||
@ -4048,10 +4048,10 @@ static int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s
|
||||
txn->req.chn->analysers = 0;
|
||||
}
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_LOCAL;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_R;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_LOCAL;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_R;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -4129,8 +4129,8 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
|
||||
s->logs.tv_request = now;
|
||||
stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_500));
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_RESOURCE;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_RESOURCE;
|
||||
goto return_prx_cond;
|
||||
}
|
||||
|
||||
@ -4180,10 +4180,10 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
|
||||
if (s->fe == s->be) /* report it if the request was intercepted by the frontend */
|
||||
s->fe->fe_counters.intercepted_req++;
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK)) // this is not really an error but it is
|
||||
s->flags |= SN_ERR_LOCAL; // to mark that it comes from the proxy
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_R;
|
||||
if (!(s->flags & SF_ERR_MASK)) // this is not really an error but it is
|
||||
s->flags |= SF_ERR_LOCAL; // to mark that it comes from the proxy
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_R;
|
||||
|
||||
/* we may want to compress the stats page */
|
||||
if (s->fe->comp || s->be->comp)
|
||||
@ -4284,10 +4284,10 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
|
||||
s->listener->counters->failed_req++;
|
||||
|
||||
return_prx_cond:
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_PRXCOND;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_R;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_PRXCOND;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_R;
|
||||
|
||||
req->analysers = 0;
|
||||
req->analyse_exp = TICK_ETERNITY;
|
||||
@ -4339,7 +4339,7 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit)
|
||||
* incoming request. Note that this requires that a connection is
|
||||
* allocated on the server side.
|
||||
*/
|
||||
if ((s->be->options & PR_O_HTTP_PROXY) && !(s->flags & SN_ADDR_SET)) {
|
||||
if ((s->be->options & PR_O_HTTP_PROXY) && !(s->flags & SF_ADDR_SET)) {
|
||||
struct connection *conn;
|
||||
char *path;
|
||||
|
||||
@ -4350,10 +4350,10 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit)
|
||||
req->analysers = 0;
|
||||
stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_500));
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_RESOURCE;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_R;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_RESOURCE;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_R;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -4408,7 +4408,7 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit)
|
||||
*/
|
||||
|
||||
/* It needs to look into the URI unless persistence must be ignored */
|
||||
if ((txn->sessid == NULL) && s->be->appsession_name && !(s->flags & SN_IGNORE_PRST)) {
|
||||
if ((txn->sessid == NULL) && s->be->appsession_name && !(s->flags & SF_IGNORE_PRST)) {
|
||||
get_srv_from_appsession(s, req->buf->p + msg->sl.rq.u, msg->sl.rq.u_l);
|
||||
}
|
||||
|
||||
@ -4582,7 +4582,7 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit)
|
||||
* with a POST request, we may be interested in checking the body for
|
||||
* that parameter. This will be done in another analyser.
|
||||
*/
|
||||
if (!(s->flags & (SN_ASSIGNED|SN_DIRECT)) &&
|
||||
if (!(s->flags & (SF_ASSIGNED|SF_DIRECT)) &&
|
||||
s->txn.meth == HTTP_METH_POST && s->be->url_param_name != NULL &&
|
||||
(msg->flags & (HTTP_MSGF_CNT_LEN|HTTP_MSGF_TE_CHNK))) {
|
||||
channel_dont_connect(req);
|
||||
@ -4639,10 +4639,10 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit)
|
||||
if (s->listener->counters)
|
||||
s->listener->counters->failed_req++;
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_PRXCOND;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_R;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_PRXCOND;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_R;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4679,10 +4679,10 @@ int http_process_tarpit(struct stream *s, struct channel *req, int an_bit)
|
||||
req->analysers = 0;
|
||||
req->analyse_exp = TICK_ETERNITY;
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_PRXCOND;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_T;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_PRXCOND;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_T;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4787,10 +4787,10 @@ int http_wait_for_request_body(struct stream *s, struct channel *req, int an_bit
|
||||
txn->status = 408;
|
||||
stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_408));
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_CLITO;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_D;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_CLITO;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_D;
|
||||
goto return_err_msg;
|
||||
}
|
||||
|
||||
@ -4820,10 +4820,10 @@ int http_wait_for_request_body(struct stream *s, struct channel *req, int an_bit
|
||||
txn->status = 400;
|
||||
stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_400));
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_PRXCOND;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_R;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_PRXCOND;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_R;
|
||||
|
||||
return_err_msg:
|
||||
req->analysers = 0;
|
||||
@ -4911,7 +4911,7 @@ void http_end_txn_clean_session(struct stream *s)
|
||||
si_shutw(&s->si[1]);
|
||||
}
|
||||
|
||||
if (s->flags & SN_BE_ASSIGNED) {
|
||||
if (s->flags & SF_BE_ASSIGNED) {
|
||||
s->be->beconn--;
|
||||
if (unlikely(s->srv_conn))
|
||||
sess_change_server(s, NULL);
|
||||
@ -4929,14 +4929,14 @@ void http_end_txn_clean_session(struct stream *s)
|
||||
|
||||
if (s->fe->mode == PR_MODE_HTTP) {
|
||||
s->fe->fe_counters.p.http.rsp[n]++;
|
||||
if (s->comp_algo && (s->flags & SN_COMP_READY))
|
||||
if (s->comp_algo && (s->flags & SF_COMP_READY))
|
||||
s->fe->fe_counters.p.http.comp_rsp++;
|
||||
}
|
||||
if ((s->flags & SN_BE_ASSIGNED) &&
|
||||
if ((s->flags & SF_BE_ASSIGNED) &&
|
||||
(s->be->mode == PR_MODE_HTTP)) {
|
||||
s->be->be_counters.p.http.rsp[n]++;
|
||||
s->be->be_counters.p.http.cum_req++;
|
||||
if (s->comp_algo && (s->flags & SN_COMP_READY))
|
||||
if (s->comp_algo && (s->flags & SF_COMP_READY))
|
||||
s->be->be_counters.p.http.comp_rsp++;
|
||||
}
|
||||
}
|
||||
@ -4947,7 +4947,7 @@ void http_end_txn_clean_session(struct stream *s)
|
||||
|
||||
/* let's do a final log if we need it */
|
||||
if (!LIST_ISEMPTY(&s->fe->logformat) && s->logs.logwait &&
|
||||
!(s->flags & SN_MONITOR) &&
|
||||
!(s->flags & SF_MONITOR) &&
|
||||
(!(s->fe->options & PR_O_NULLNOLOG) || s->req.total)) {
|
||||
s->do_log(s);
|
||||
}
|
||||
@ -4973,8 +4973,8 @@ void http_end_txn_clean_session(struct stream *s)
|
||||
pendconn_free(s->pend_pos);
|
||||
|
||||
if (objt_server(s->target)) {
|
||||
if (s->flags & SN_CURR_SESS) {
|
||||
s->flags &= ~SN_CURR_SESS;
|
||||
if (s->flags & SF_CURR_SESS) {
|
||||
s->flags &= ~SF_CURR_SESS;
|
||||
objt_server(s->target)->cur_sess--;
|
||||
}
|
||||
if (may_dequeue_tasks(objt_server(s->target), s->be))
|
||||
@ -4998,9 +4998,9 @@ void http_end_txn_clean_session(struct stream *s)
|
||||
s->si[1].flags &= SI_FL_ISBACK | SI_FL_DONT_WAKE; /* we're in the context of process_stream */
|
||||
s->req.flags &= ~(CF_SHUTW|CF_SHUTW_NOW|CF_AUTO_CONNECT|CF_WRITE_ERROR|CF_STREAMER|CF_STREAMER_FAST|CF_NEVER_WAIT|CF_WAKE_CONNECT|CF_WROTE_DATA);
|
||||
s->res.flags &= ~(CF_SHUTR|CF_SHUTR_NOW|CF_READ_ATTACHED|CF_READ_ERROR|CF_READ_NOEXP|CF_STREAMER|CF_STREAMER_FAST|CF_WRITE_PARTIAL|CF_NEVER_WAIT|CF_WROTE_DATA);
|
||||
s->flags &= ~(SN_DIRECT|SN_ASSIGNED|SN_ADDR_SET|SN_BE_ASSIGNED|SN_FORCE_PRST|SN_IGNORE_PRST);
|
||||
s->flags &= ~(SN_CURR_SESS|SN_REDIRECTABLE|SN_SRV_REUSED);
|
||||
s->flags &= ~(SN_ERR_MASK|SN_FINST_MASK|SN_REDISP);
|
||||
s->flags &= ~(SF_DIRECT|SF_ASSIGNED|SF_ADDR_SET|SF_BE_ASSIGNED|SF_FORCE_PRST|SF_IGNORE_PRST);
|
||||
s->flags &= ~(SF_CURR_SESS|SF_REDIRECTABLE|SF_SRV_REUSED);
|
||||
s->flags &= ~(SF_ERR_MASK|SF_FINST_MASK|SF_REDISP);
|
||||
|
||||
s->txn.meth = 0;
|
||||
http_reset_txn(s);
|
||||
@ -5601,13 +5601,13 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit)
|
||||
|
||||
/* stop waiting for data if the input is closed before the end */
|
||||
if (req->flags & CF_SHUTR) {
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_CLICL;
|
||||
if (!(s->flags & SN_FINST_MASK)) {
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_CLICL;
|
||||
if (!(s->flags & SF_FINST_MASK)) {
|
||||
if (txn->rsp.msg_state < HTTP_MSG_ERROR)
|
||||
s->flags |= SN_FINST_H;
|
||||
s->flags |= SF_FINST_H;
|
||||
else
|
||||
s->flags |= SN_FINST_D;
|
||||
s->flags |= SF_FINST_D;
|
||||
}
|
||||
|
||||
s->fe->fe_counters.cli_aborts++;
|
||||
@ -5662,13 +5662,13 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit)
|
||||
req->analysers = 0;
|
||||
s->res.analysers = 0; /* we're in data phase, we want to abort both directions */
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_PRXCOND;
|
||||
if (!(s->flags & SN_FINST_MASK)) {
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_PRXCOND;
|
||||
if (!(s->flags & SF_FINST_MASK)) {
|
||||
if (txn->rsp.msg_state < HTTP_MSG_ERROR)
|
||||
s->flags |= SN_FINST_H;
|
||||
s->flags |= SF_FINST_H;
|
||||
else
|
||||
s->flags |= SN_FINST_D;
|
||||
s->flags |= SF_FINST_D;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@ -5689,13 +5689,13 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit)
|
||||
if (objt_server(s->target))
|
||||
objt_server(s->target)->counters.srv_aborts++;
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_SRVCL;
|
||||
if (!(s->flags & SN_FINST_MASK)) {
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_SRVCL;
|
||||
if (!(s->flags & SF_FINST_MASK)) {
|
||||
if (txn->rsp.msg_state < HTTP_MSG_ERROR)
|
||||
s->flags |= SN_FINST_H;
|
||||
s->flags |= SF_FINST_H;
|
||||
else
|
||||
s->flags |= SN_FINST_D;
|
||||
s->flags |= SF_FINST_D;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -5823,10 +5823,10 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
||||
channel_truncate(rep);
|
||||
stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_502));
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_PRXCOND;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_H;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_PRXCOND;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_H;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -5858,10 +5858,10 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
||||
channel_truncate(rep);
|
||||
stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_502));
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_SRVCL;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_H;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_SRVCL;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_H;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -5885,10 +5885,10 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
||||
channel_truncate(rep);
|
||||
stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_504));
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_SRVTO;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_H;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_SRVTO;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_H;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -5906,10 +5906,10 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
||||
channel_truncate(rep);
|
||||
stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_400));
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_CLICL;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_H;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_CLICL;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_H;
|
||||
|
||||
/* process_stream() will take care of the error */
|
||||
return 0;
|
||||
@ -5935,10 +5935,10 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
||||
channel_truncate(rep);
|
||||
stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_502));
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_SRVCL;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_H;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_SRVCL;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_H;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -5953,10 +5953,10 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
||||
rep->analysers = 0;
|
||||
channel_auto_close(rep);
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_CLICL;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_H;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_CLICL;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_H;
|
||||
|
||||
/* process_stream() will take care of the error */
|
||||
return 0;
|
||||
@ -6354,10 +6354,10 @@ int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, s
|
||||
s->si[1].flags |= SI_FL_NOLINGER;
|
||||
channel_truncate(rep);
|
||||
stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_502));
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_PRXCOND;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_H;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_PRXCOND;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_H;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -6428,13 +6428,13 @@ int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, s
|
||||
*/
|
||||
if (objt_server(s->target) && (s->be->ck_opts & PR_CK_INS) &&
|
||||
!((txn->flags & TX_SCK_FOUND) && (s->be->ck_opts & PR_CK_PSV)) &&
|
||||
(!(s->flags & SN_DIRECT) ||
|
||||
(!(s->flags & SF_DIRECT) ||
|
||||
((s->be->cookie_maxidle || txn->cookie_last_date) &&
|
||||
(!txn->cookie_last_date || (txn->cookie_last_date - date.tv_sec) < 0)) ||
|
||||
(s->be->cookie_maxlife && !txn->cookie_first_date) || // set the first_date
|
||||
(!s->be->cookie_maxlife && txn->cookie_first_date)) && // remove the first_date
|
||||
(!(s->be->ck_opts & PR_CK_POST) || (txn->meth == HTTP_METH_POST)) &&
|
||||
!(s->flags & SN_IGNORE_PRST)) {
|
||||
!(s->flags & SF_IGNORE_PRST)) {
|
||||
/* the server is known, it's not the one the client requested, or the
|
||||
* cookie's last seen date needs to be refreshed. We have to
|
||||
* insert a set-cookie here, except if we want to insert only on POST
|
||||
@ -6482,7 +6482,7 @@ int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, s
|
||||
goto return_bad_resp;
|
||||
|
||||
txn->flags &= ~TX_SCK_MASK;
|
||||
if (objt_server(s->target)->cookie && (s->flags & SN_DIRECT))
|
||||
if (objt_server(s->target)->cookie && (s->flags & SF_DIRECT))
|
||||
/* the server did not change, only the date was updated */
|
||||
txn->flags |= TX_SCK_UPDATED;
|
||||
else
|
||||
@ -6832,8 +6832,8 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit
|
||||
if (res->flags & CF_SHUTR) {
|
||||
if ((s->req.flags & (CF_SHUTR|CF_SHUTW)) == (CF_SHUTR|CF_SHUTW))
|
||||
goto aborted_xfer;
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_SRVCL;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_SRVCL;
|
||||
s->be->be_counters.srv_aborts++;
|
||||
if (objt_server(s->target))
|
||||
objt_server(s->target)->counters.srv_aborts++;
|
||||
@ -6893,10 +6893,10 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit
|
||||
if (objt_server(s->target))
|
||||
health_adjust(objt_server(s->target), HANA_STATUS_HTTP_HDRRSP);
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_PRXCOND;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_D;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_PRXCOND;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_D;
|
||||
return 0;
|
||||
|
||||
aborted_xfer:
|
||||
@ -6916,10 +6916,10 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit
|
||||
if (objt_server(s->target))
|
||||
objt_server(s->target)->counters.cli_aborts++;
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_CLICL;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_D;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_CLICL;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_D;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -7242,11 +7242,11 @@ void manage_client_side_appsession(struct stream *s, const char *buf, int len) {
|
||||
if (strcmp(srv->id, asession->serverid) == 0) {
|
||||
if ((srv->state != SRV_ST_STOPPED) ||
|
||||
(s->be->options & PR_O_PERSIST) ||
|
||||
(s->flags & SN_FORCE_PRST)) {
|
||||
(s->flags & SF_FORCE_PRST)) {
|
||||
/* we found the server and it's usable */
|
||||
txn->flags &= ~TX_CK_MASK;
|
||||
txn->flags |= (srv->state != SRV_ST_STOPPED) ? TX_CK_VALID : TX_CK_DOWN;
|
||||
s->flags |= SN_DIRECT | SN_ASSIGNED;
|
||||
s->flags |= SF_DIRECT | SF_ASSIGNED;
|
||||
s->target = &srv->obj_type;
|
||||
|
||||
break;
|
||||
@ -7644,7 +7644,7 @@ void manage_client_side_cookies(struct stream *s, struct channel *req)
|
||||
* empty cookies and mark them as invalid.
|
||||
* The same behaviour is applied when persistence must be ignored.
|
||||
*/
|
||||
if ((delim == val_beg) || (s->flags & (SN_IGNORE_PRST | SN_ASSIGNED)))
|
||||
if ((delim == val_beg) || (s->flags & (SF_IGNORE_PRST | SF_ASSIGNED)))
|
||||
srv = NULL;
|
||||
|
||||
while (srv) {
|
||||
@ -7652,11 +7652,11 @@ void manage_client_side_cookies(struct stream *s, struct channel *req)
|
||||
!memcmp(val_beg, srv->cookie, delim - val_beg)) {
|
||||
if ((srv->state != SRV_ST_STOPPED) ||
|
||||
(s->be->options & PR_O_PERSIST) ||
|
||||
(s->flags & SN_FORCE_PRST)) {
|
||||
(s->flags & SF_FORCE_PRST)) {
|
||||
/* we found the server and we can use it */
|
||||
txn->flags &= ~TX_CK_MASK;
|
||||
txn->flags |= (srv->state != SRV_ST_STOPPED) ? TX_CK_VALID : TX_CK_DOWN;
|
||||
s->flags |= SN_DIRECT | SN_ASSIGNED;
|
||||
s->flags |= SF_DIRECT | SF_ASSIGNED;
|
||||
s->target = &srv->obj_type;
|
||||
break;
|
||||
} else {
|
||||
@ -7674,7 +7674,7 @@ void manage_client_side_cookies(struct stream *s, struct channel *req)
|
||||
if (!srv && !(txn->flags & (TX_CK_DOWN|TX_CK_EXPIRED|TX_CK_OLD))) {
|
||||
/* no server matched this cookie or we deliberately skipped it */
|
||||
txn->flags &= ~TX_CK_MASK;
|
||||
if ((s->flags & (SN_IGNORE_PRST | SN_ASSIGNED)))
|
||||
if ((s->flags & (SF_IGNORE_PRST | SF_ASSIGNED)))
|
||||
txn->flags |= TX_CK_UNUSED;
|
||||
else
|
||||
txn->flags |= TX_CK_INVALID;
|
||||
@ -7731,7 +7731,7 @@ void manage_client_side_cookies(struct stream *s, struct channel *req)
|
||||
}
|
||||
|
||||
/* Look for the appsession cookie unless persistence must be ignored */
|
||||
if (!(s->flags & SN_IGNORE_PRST) && (s->be->appsession_name != NULL)) {
|
||||
if (!(s->flags & SF_IGNORE_PRST) && (s->be->appsession_name != NULL)) {
|
||||
int cmp_len, value_len;
|
||||
char *value_begin;
|
||||
|
||||
@ -8220,7 +8220,7 @@ void manage_server_side_cookies(struct stream *s, struct channel *res)
|
||||
|
||||
srv = objt_server(s->target);
|
||||
/* now check if we need to process it for persistence */
|
||||
if (!(s->flags & SN_IGNORE_PRST) &&
|
||||
if (!(s->flags & SF_IGNORE_PRST) &&
|
||||
(att_end - att_beg == s->be->cookie_len) && (s->be->cookie_name != NULL) &&
|
||||
(memcmp(att_beg, s->be->cookie_name, att_end - att_beg) == 0)) {
|
||||
/* assume passive cookie by default */
|
||||
@ -8238,7 +8238,7 @@ void manage_server_side_cookies(struct stream *s, struct channel *res)
|
||||
*/
|
||||
}
|
||||
else if ((srv && (s->be->ck_opts & PR_CK_INS)) ||
|
||||
((s->flags & SN_DIRECT) && (s->be->ck_opts & PR_CK_IND))) {
|
||||
((s->flags & SF_DIRECT) && (s->be->ck_opts & PR_CK_IND))) {
|
||||
/* this cookie must be deleted */
|
||||
if (*prev == ':' && next == hdr_end) {
|
||||
/* whole header */
|
||||
@ -8296,7 +8296,7 @@ void manage_server_side_cookies(struct stream *s, struct channel *res)
|
||||
}
|
||||
}
|
||||
/* next, let's see if the cookie is our appcookie, unless persistence must be ignored */
|
||||
else if (!(s->flags & SN_IGNORE_PRST) && (s->be->appsession_name != NULL)) {
|
||||
else if (!(s->flags & SF_IGNORE_PRST) && (s->be->appsession_name != NULL)) {
|
||||
int cmp_len, value_len;
|
||||
char *value_begin;
|
||||
|
||||
@ -8822,10 +8822,10 @@ void http_end_txn(struct stream *s)
|
||||
struct http_txn *txn = &s->txn;
|
||||
|
||||
/* release any possible compression context */
|
||||
if (s->flags & SN_COMP_READY)
|
||||
if (s->flags & SF_COMP_READY)
|
||||
s->comp_algo->end(&s->comp_ctx);
|
||||
s->comp_algo = NULL;
|
||||
s->flags &= ~SN_COMP_READY;
|
||||
s->flags &= ~SF_COMP_READY;
|
||||
|
||||
/* these ones will have been dynamically allocated */
|
||||
pool_free2(pool2_requri, txn->uri);
|
||||
@ -9917,7 +9917,7 @@ smp_prefetch_http(struct proxy *px, struct stream *s, void *l7, unsigned int opt
|
||||
|
||||
txn->meth = find_http_meth(msg->chn->buf->p, msg->sl.rq.m_l);
|
||||
if (txn->meth == HTTP_METH_GET || txn->meth == HTTP_METH_HEAD)
|
||||
s->flags |= SN_REDIRECTABLE;
|
||||
s->flags |= SF_REDIRECTABLE;
|
||||
|
||||
if (unlikely(msg->sl.rq.v_l == 0) && !http_upgrade_v09_to_v10(txn))
|
||||
return 0;
|
||||
|
@ -357,15 +357,15 @@ static int create_server_socket(struct connection *conn)
|
||||
* Note that a pending send_proxy message accounts for data.
|
||||
*
|
||||
* It can return one of :
|
||||
* - SN_ERR_NONE if everything's OK
|
||||
* - SN_ERR_SRVTO if there are no more servers
|
||||
* - SN_ERR_SRVCL if the connection was refused by the server
|
||||
* - SN_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
|
||||
* - SN_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
|
||||
* - SN_ERR_INTERNAL for any other purely internal errors
|
||||
* Additionnally, in the case of SN_ERR_RESOURCE, an emergency log will be emitted.
|
||||
* - SF_ERR_NONE if everything's OK
|
||||
* - SF_ERR_SRVTO if there are no more servers
|
||||
* - SF_ERR_SRVCL if the connection was refused by the server
|
||||
* - SF_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
|
||||
* - SF_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
|
||||
* - SF_ERR_INTERNAL for any other purely internal errors
|
||||
* Additionnally, in the case of SF_ERR_RESOURCE, an emergency log will be emitted.
|
||||
*
|
||||
* The connection's fd is inserted only when SN_ERR_NONE is returned, otherwise
|
||||
* The connection's fd is inserted only when SF_ERR_NONE is returned, otherwise
|
||||
* it's invalid and the caller has nothing to do.
|
||||
*/
|
||||
|
||||
@ -389,7 +389,7 @@ int tcp_connect_server(struct connection *conn, int data, int delack)
|
||||
break;
|
||||
default:
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
return SN_ERR_INTERNAL;
|
||||
return SF_ERR_INTERNAL;
|
||||
}
|
||||
|
||||
fd = conn->t.sock.fd = create_server_socket(conn);
|
||||
@ -423,7 +423,7 @@ int tcp_connect_server(struct connection *conn, int data, int delack)
|
||||
|
||||
/* this is a resource error */
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
return SN_ERR_RESOURCE;
|
||||
return SF_ERR_RESOURCE;
|
||||
}
|
||||
|
||||
if (fd >= global.maxsock) {
|
||||
@ -434,7 +434,7 @@ int tcp_connect_server(struct connection *conn, int data, int delack)
|
||||
close(fd);
|
||||
conn->err_code = CO_ER_CONF_FDLIM;
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
return SN_ERR_PRXCOND; /* it is a configuration limit */
|
||||
return SF_ERR_PRXCOND; /* it is a configuration limit */
|
||||
}
|
||||
|
||||
if ((fcntl(fd, F_SETFL, O_NONBLOCK)==-1) ||
|
||||
@ -443,7 +443,7 @@ int tcp_connect_server(struct connection *conn, int data, int delack)
|
||||
close(fd);
|
||||
conn->err_code = CO_ER_SOCK_ERR;
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
return SN_ERR_INTERNAL;
|
||||
return SF_ERR_INTERNAL;
|
||||
}
|
||||
|
||||
if (be->options & PR_O_TCP_SRV_KA)
|
||||
@ -539,7 +539,7 @@ int tcp_connect_server(struct connection *conn, int data, int delack)
|
||||
be->id);
|
||||
}
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
return SN_ERR_RESOURCE;
|
||||
return SF_ERR_RESOURCE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -578,7 +578,7 @@ int tcp_connect_server(struct connection *conn, int data, int delack)
|
||||
close(fd);
|
||||
send_log(be, LOG_ERR, "Connect() failed for backend %s: %s.\n", be->id, msg);
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
return SN_ERR_RESOURCE;
|
||||
return SF_ERR_RESOURCE;
|
||||
} else if (errno == ETIMEDOUT) {
|
||||
//qfprintf(stderr,"Connect(): ETIMEDOUT");
|
||||
port_range_release_port(fdinfo[fd].port_range, fdinfo[fd].local_port);
|
||||
@ -586,7 +586,7 @@ int tcp_connect_server(struct connection *conn, int data, int delack)
|
||||
close(fd);
|
||||
conn->err_code = CO_ER_SOCK_ERR;
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
return SN_ERR_SRVTO;
|
||||
return SF_ERR_SRVTO;
|
||||
} else {
|
||||
// (errno == ECONNREFUSED || errno == ENETUNREACH || errno == EACCES || errno == EPERM)
|
||||
//qfprintf(stderr,"Connect(): %d", errno);
|
||||
@ -595,7 +595,7 @@ int tcp_connect_server(struct connection *conn, int data, int delack)
|
||||
close(fd);
|
||||
conn->err_code = CO_ER_SOCK_ERR;
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
return SN_ERR_SRVCL;
|
||||
return SF_ERR_SRVCL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -612,13 +612,13 @@ int tcp_connect_server(struct connection *conn, int data, int delack)
|
||||
if (conn_xprt_init(conn) < 0) {
|
||||
conn_force_close(conn);
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
return SN_ERR_RESOURCE;
|
||||
return SF_ERR_RESOURCE;
|
||||
}
|
||||
|
||||
if (data)
|
||||
conn_data_want_send(conn); /* prepare to send data if any */
|
||||
|
||||
return SN_ERR_NONE; /* connection is OK */
|
||||
return SF_ERR_NONE; /* connection is OK */
|
||||
}
|
||||
|
||||
|
||||
@ -1157,10 +1157,10 @@ int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit)
|
||||
if (s->listener->counters)
|
||||
s->listener->counters->denied_req++;
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_PRXCOND;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_R;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_PRXCOND;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_R;
|
||||
return 0;
|
||||
}
|
||||
else if (rule->action >= TCP_ACT_TRK_SC0 && rule->action <= TCP_ACT_TRK_SCMAX) {
|
||||
@ -1318,10 +1318,10 @@ int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit)
|
||||
if (s->listener->counters)
|
||||
s->listener->counters->denied_resp++;
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_PRXCOND;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_D;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_PRXCOND;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_D;
|
||||
return 0;
|
||||
}
|
||||
else if (rule->action == TCP_ACT_CLOSE) {
|
||||
@ -1387,10 +1387,10 @@ int tcp_exec_req_rules(struct stream *s)
|
||||
if (s->listener->counters)
|
||||
s->listener->counters->denied_conn++;
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_PRXCOND;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_R;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_PRXCOND;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_R;
|
||||
result = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -401,15 +401,15 @@ int uxst_pause_listener(struct listener *l)
|
||||
* Note that a pending send_proxy message accounts for data.
|
||||
*
|
||||
* It can return one of :
|
||||
* - SN_ERR_NONE if everything's OK
|
||||
* - SN_ERR_SRVTO if there are no more servers
|
||||
* - SN_ERR_SRVCL if the connection was refused by the server
|
||||
* - SN_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
|
||||
* - SN_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
|
||||
* - SN_ERR_INTERNAL for any other purely internal errors
|
||||
* Additionnally, in the case of SN_ERR_RESOURCE, an emergency log will be emitted.
|
||||
* - SF_ERR_NONE if everything's OK
|
||||
* - SF_ERR_SRVTO if there are no more servers
|
||||
* - SF_ERR_SRVCL if the connection was refused by the server
|
||||
* - SF_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
|
||||
* - SF_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
|
||||
* - SF_ERR_INTERNAL for any other purely internal errors
|
||||
* Additionnally, in the case of SF_ERR_RESOURCE, an emergency log will be emitted.
|
||||
*
|
||||
* The connection's fd is inserted only when SN_ERR_NONE is returned, otherwise
|
||||
* The connection's fd is inserted only when SF_ERR_NONE is returned, otherwise
|
||||
* it's invalid and the caller has nothing to do.
|
||||
*/
|
||||
int uxst_connect_server(struct connection *conn, int data, int delack)
|
||||
@ -431,7 +431,7 @@ int uxst_connect_server(struct connection *conn, int data, int delack)
|
||||
break;
|
||||
default:
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
return SN_ERR_INTERNAL;
|
||||
return SF_ERR_INTERNAL;
|
||||
}
|
||||
|
||||
if ((fd = conn->t.sock.fd = socket(PF_UNIX, SOCK_STREAM, 0)) == -1) {
|
||||
@ -463,7 +463,7 @@ int uxst_connect_server(struct connection *conn, int data, int delack)
|
||||
|
||||
/* this is a resource error */
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
return SN_ERR_RESOURCE;
|
||||
return SF_ERR_RESOURCE;
|
||||
}
|
||||
|
||||
if (fd >= global.maxsock) {
|
||||
@ -474,7 +474,7 @@ int uxst_connect_server(struct connection *conn, int data, int delack)
|
||||
close(fd);
|
||||
conn->err_code = CO_ER_CONF_FDLIM;
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
return SN_ERR_PRXCOND; /* it is a configuration limit */
|
||||
return SF_ERR_PRXCOND; /* it is a configuration limit */
|
||||
}
|
||||
|
||||
if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) {
|
||||
@ -482,7 +482,7 @@ int uxst_connect_server(struct connection *conn, int data, int delack)
|
||||
close(fd);
|
||||
conn->err_code = CO_ER_SOCK_ERR;
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
return SN_ERR_INTERNAL;
|
||||
return SF_ERR_INTERNAL;
|
||||
}
|
||||
|
||||
/* if a send_proxy is there, there are data */
|
||||
@ -516,19 +516,19 @@ int uxst_connect_server(struct connection *conn, int data, int delack)
|
||||
close(fd);
|
||||
send_log(be, LOG_ERR, "Connect() failed for backend %s: %s.\n", be->id, msg);
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
return SN_ERR_RESOURCE;
|
||||
return SF_ERR_RESOURCE;
|
||||
}
|
||||
else if (errno == ETIMEDOUT) {
|
||||
close(fd);
|
||||
conn->err_code = CO_ER_SOCK_ERR;
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
return SN_ERR_SRVTO;
|
||||
return SF_ERR_SRVTO;
|
||||
}
|
||||
else { // (errno == ECONNREFUSED || errno == ENETUNREACH || errno == EACCES || errno == EPERM)
|
||||
close(fd);
|
||||
conn->err_code = CO_ER_SOCK_ERR;
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
return SN_ERR_SRVCL;
|
||||
return SF_ERR_SRVCL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -556,13 +556,13 @@ int uxst_connect_server(struct connection *conn, int data, int delack)
|
||||
if (conn_xprt_init(conn) < 0) {
|
||||
conn_force_close(conn);
|
||||
conn->flags |= CO_FL_ERROR;
|
||||
return SN_ERR_RESOURCE;
|
||||
return SF_ERR_RESOURCE;
|
||||
}
|
||||
|
||||
if (data)
|
||||
conn_data_want_send(conn); /* prepare to send data if any */
|
||||
|
||||
return SN_ERR_NONE; /* connection is OK */
|
||||
return SF_ERR_NONE; /* connection is OK */
|
||||
}
|
||||
|
||||
|
||||
|
@ -920,13 +920,13 @@ void resume_proxies(void)
|
||||
|
||||
/* Set current stream's backend to <be>. Nothing is done if the
|
||||
* stream already had a backend assigned, which is indicated by
|
||||
* s->flags & SN_BE_ASSIGNED.
|
||||
* s->flags & SF_BE_ASSIGNED.
|
||||
* All flags, stats and counters which need be updated are updated.
|
||||
* Returns 1 if done, 0 in case of internal error, eg: lack of resource.
|
||||
*/
|
||||
int stream_set_backend(struct stream *s, struct proxy *be)
|
||||
{
|
||||
if (s->flags & SN_BE_ASSIGNED)
|
||||
if (s->flags & SF_BE_ASSIGNED)
|
||||
return 1;
|
||||
s->be = be;
|
||||
be->beconn++;
|
||||
@ -941,7 +941,7 @@ int stream_set_backend(struct stream *s, struct proxy *be)
|
||||
|
||||
if (be->options2 & PR_O2_RSPBUG_OK)
|
||||
s->txn.rsp.err_pos = -1; /* let buggy responses pass */
|
||||
s->flags |= SN_BE_ASSIGNED;
|
||||
s->flags |= SF_BE_ASSIGNED;
|
||||
|
||||
/* If the target backend requires HTTP processing, we have to allocate
|
||||
* a struct hdr_idx for it if we did not have one.
|
||||
|
@ -122,7 +122,7 @@ struct stream *pendconn_get_next_strm(struct server *srv, struct proxy *px)
|
||||
pendconn_free(ps);
|
||||
|
||||
/* we want to note that the stream has now been assigned a server */
|
||||
strm->flags |= SN_ASSIGNED;
|
||||
strm->flags |= SF_ASSIGNED;
|
||||
strm->target = &srv->obj_type;
|
||||
stream_add_srv_conn(strm, srv);
|
||||
srv->served++;
|
||||
@ -151,7 +151,7 @@ struct pendconn *pendconn_add(struct stream *strm)
|
||||
p->strm = strm;
|
||||
p->srv = srv = objt_server(strm->target);
|
||||
|
||||
if (strm->flags & SN_ASSIGNED && srv) {
|
||||
if (strm->flags & SF_ASSIGNED && srv) {
|
||||
LIST_ADDQ(&srv->pendconns, &p->list);
|
||||
srv->nbpend++;
|
||||
strm->logs.srv_queue_size += srv->nbpend;
|
||||
@ -180,13 +180,13 @@ int pendconn_redistribute(struct server *s)
|
||||
struct stream *strm = pc->strm;
|
||||
|
||||
if ((strm->be->options & (PR_O_REDISP|PR_O_PERSIST)) == PR_O_REDISP &&
|
||||
!(strm->flags & SN_FORCE_PRST)) {
|
||||
!(strm->flags & SF_FORCE_PRST)) {
|
||||
/* The REDISP option was specified. We will ignore
|
||||
* cookie and force to balance or use the dispatcher.
|
||||
*/
|
||||
|
||||
/* it's left to the dispatcher to choose a server */
|
||||
strm->flags &= ~(SN_DIRECT | SN_ASSIGNED | SN_ADDR_SET);
|
||||
strm->flags &= ~(SF_DIRECT | SF_ASSIGNED | SF_ADDR_SET);
|
||||
|
||||
pendconn_free(pc);
|
||||
task_wakeup(strm->task, TASK_WOKEN_RES);
|
||||
|
12
src/server.c
12
src/server.c
@ -163,7 +163,7 @@ static int srv_parse_id(char **args, int *cur_arg, struct proxy *curproxy, struc
|
||||
}
|
||||
|
||||
/* Shutdown all connections of a server. The caller must pass a termination
|
||||
* code in <why>, which must be one of SN_ERR_* indicating the reason for the
|
||||
* code in <why>, which must be one of SF_ERR_* indicating the reason for the
|
||||
* shutdown.
|
||||
*/
|
||||
void srv_shutdown_streams(struct server *srv, int why)
|
||||
@ -176,7 +176,7 @@ void srv_shutdown_streams(struct server *srv, int why)
|
||||
}
|
||||
|
||||
/* Shutdown all connections of all backup servers of a proxy. The caller must
|
||||
* pass a termination code in <why>, which must be one of SN_ERR_* indicating
|
||||
* pass a termination code in <why>, which must be one of SF_ERR_* indicating
|
||||
* the reason for the shutdown.
|
||||
*/
|
||||
void srv_shutdown_backup_streams(struct proxy *px, int why)
|
||||
@ -244,7 +244,7 @@ void srv_set_stopped(struct server *s, const char *reason)
|
||||
s->proxy->lbprm.set_server_status_down(s);
|
||||
|
||||
if (s->onmarkeddown & HANA_ONMARKEDDOWN_SHUTDOWNSESSIONS)
|
||||
srv_shutdown_streams(s, SN_ERR_DOWN);
|
||||
srv_shutdown_streams(s, SF_ERR_DOWN);
|
||||
|
||||
/* we might have streams queued on this server and waiting for
|
||||
* a connection. Those which are redispatchable will be queued
|
||||
@ -318,7 +318,7 @@ void srv_set_running(struct server *s, const char *reason)
|
||||
*/
|
||||
if ((s->onmarkedup & HANA_ONMARKEDUP_SHUTDOWNBACKUPSESSIONS) &&
|
||||
!(s->flags & SRV_F_BACKUP) && s->eweight)
|
||||
srv_shutdown_backup_streams(s->proxy, SN_ERR_UP);
|
||||
srv_shutdown_backup_streams(s->proxy, SF_ERR_UP);
|
||||
|
||||
/* check if we can handle some connections queued at the proxy. We
|
||||
* will take as many as we can handle.
|
||||
@ -438,7 +438,7 @@ void srv_set_admin_flag(struct server *s, enum srv_admin mode)
|
||||
s->proxy->lbprm.set_server_status_down(s);
|
||||
|
||||
if (s->onmarkeddown & HANA_ONMARKEDDOWN_SHUTDOWNSESSIONS)
|
||||
srv_shutdown_streams(s, SN_ERR_DOWN);
|
||||
srv_shutdown_streams(s, SF_ERR_DOWN);
|
||||
|
||||
/* we might have streams queued on this server and waiting for
|
||||
* a connection. Those which are redispatchable will be queued
|
||||
@ -600,7 +600,7 @@ void srv_clr_admin_flag(struct server *s, enum srv_admin mode)
|
||||
*/
|
||||
if ((s->onmarkedup & HANA_ONMARKEDUP_SHUTDOWNBACKUPSESSIONS) &&
|
||||
!(s->flags & SRV_F_BACKUP) && s->eweight)
|
||||
srv_shutdown_backup_streams(s->proxy, SN_ERR_UP);
|
||||
srv_shutdown_backup_streams(s->proxy, SF_ERR_UP);
|
||||
|
||||
/* check if we can handle some connections queued at the proxy. We
|
||||
* will take as many as we can handle.
|
||||
|
158
src/stream.c
158
src/stream.c
@ -423,7 +423,7 @@ int stream_complete(struct stream *s)
|
||||
LIST_INIT(&s->back_refs);
|
||||
LIST_INIT(&s->buffer_wait);
|
||||
|
||||
s->flags |= SN_INITIALIZED;
|
||||
s->flags |= SF_INITIALIZED;
|
||||
s->unique_id = NULL;
|
||||
|
||||
t->process = l->handler;
|
||||
@ -586,8 +586,8 @@ static void stream_free(struct stream *s)
|
||||
pendconn_free(s->pend_pos);
|
||||
|
||||
if (objt_server(s->target)) { /* there may be requests left pending in queue */
|
||||
if (s->flags & SN_CURR_SESS) {
|
||||
s->flags &= ~SN_CURR_SESS;
|
||||
if (s->flags & SF_CURR_SESS) {
|
||||
s->flags &= ~SF_CURR_SESS;
|
||||
objt_server(s->target)->cur_sess--;
|
||||
}
|
||||
if (may_dequeue_tasks(objt_server(s->target), s->be))
|
||||
@ -943,8 +943,8 @@ static int sess_update_st_cer(struct stream *s)
|
||||
if (objt_server(s->target)) {
|
||||
health_adjust(objt_server(s->target), HANA_STATUS_L4_ERR);
|
||||
|
||||
if (s->flags & SN_CURR_SESS) {
|
||||
s->flags &= ~SN_CURR_SESS;
|
||||
if (s->flags & SF_CURR_SESS) {
|
||||
s->flags &= ~SF_CURR_SESS;
|
||||
objt_server(s->target)->cur_sess--;
|
||||
}
|
||||
}
|
||||
@ -986,14 +986,14 @@ static int sess_update_st_cer(struct stream *s)
|
||||
*/
|
||||
if (objt_server(s->target) &&
|
||||
(si->conn_retries == 0 ||
|
||||
(!(s->flags & SN_DIRECT) && s->be->srv_act > 1 &&
|
||||
(!(s->flags & SF_DIRECT) && s->be->srv_act > 1 &&
|
||||
((s->be->lbprm.algo & BE_LB_KIND) == BE_LB_KIND_RR))) &&
|
||||
s->be->options & PR_O_REDISP && !(s->flags & SN_FORCE_PRST)) {
|
||||
s->be->options & PR_O_REDISP && !(s->flags & SF_FORCE_PRST)) {
|
||||
sess_change_server(s, NULL);
|
||||
if (may_dequeue_tasks(objt_server(s->target), s->be))
|
||||
process_srv_queue(objt_server(s->target));
|
||||
|
||||
s->flags &= ~(SN_DIRECT | SN_ASSIGNED | SN_ADDR_SET);
|
||||
s->flags &= ~(SF_DIRECT | SF_ASSIGNED | SF_ADDR_SET);
|
||||
si->state = SI_ST_REQ;
|
||||
} else {
|
||||
if (objt_server(s->target))
|
||||
@ -1101,7 +1101,7 @@ static void sess_update_stream_int(struct stream *s)
|
||||
conn_err = connect_server(s);
|
||||
srv = objt_server(s->target);
|
||||
|
||||
if (conn_err == SN_ERR_NONE) {
|
||||
if (conn_err == SF_ERR_NONE) {
|
||||
/* state = SI_ST_CON or SI_ST_EST now */
|
||||
if (srv)
|
||||
srv_inc_sess_ctr(srv);
|
||||
@ -1113,7 +1113,7 @@ static void sess_update_stream_int(struct stream *s)
|
||||
/* We have received a synchronous error. We might have to
|
||||
* abort, retry immediately or redispatch.
|
||||
*/
|
||||
if (conn_err == SN_ERR_INTERNAL) {
|
||||
if (conn_err == SF_ERR_INTERNAL) {
|
||||
if (!si->err_type) {
|
||||
si->err_type = SI_ET_CONN_OTHER;
|
||||
}
|
||||
@ -1164,7 +1164,7 @@ static void sess_update_stream_int(struct stream *s)
|
||||
* load-balance first and go to the INI state.
|
||||
*/
|
||||
si->exp = TICK_ETERNITY;
|
||||
if (unlikely(!(s->flags & SN_ASSIGNED)))
|
||||
if (unlikely(!(s->flags & SF_ASSIGNED)))
|
||||
si->state = SI_ST_REQ;
|
||||
else {
|
||||
s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
|
||||
@ -1236,7 +1236,7 @@ static void sess_update_stream_int(struct stream *s)
|
||||
* marked "assigned".
|
||||
* FIXME: Should we force a redispatch attempt when the server is down ?
|
||||
*/
|
||||
if (s->flags & SN_ASSIGNED)
|
||||
if (s->flags & SF_ASSIGNED)
|
||||
si->state = SI_ST_ASS;
|
||||
else
|
||||
si->state = SI_ST_REQ;
|
||||
@ -1250,23 +1250,23 @@ static void sess_update_stream_int(struct stream *s)
|
||||
*/
|
||||
static void sess_set_term_flags(struct stream *s)
|
||||
{
|
||||
if (!(s->flags & SN_FINST_MASK)) {
|
||||
if (!(s->flags & SF_FINST_MASK)) {
|
||||
if (s->si[1].state < SI_ST_REQ) {
|
||||
|
||||
s->fe->fe_counters.failed_req++;
|
||||
if (s->listener->counters)
|
||||
s->listener->counters->failed_req++;
|
||||
|
||||
s->flags |= SN_FINST_R;
|
||||
s->flags |= SF_FINST_R;
|
||||
}
|
||||
else if (s->si[1].state == SI_ST_QUE)
|
||||
s->flags |= SN_FINST_Q;
|
||||
s->flags |= SF_FINST_Q;
|
||||
else if (s->si[1].state < SI_ST_EST)
|
||||
s->flags |= SN_FINST_C;
|
||||
s->flags |= SF_FINST_C;
|
||||
else if (s->si[1].state == SI_ST_EST || s->si[1].prev_state == SI_ST_EST)
|
||||
s->flags |= SN_FINST_D;
|
||||
s->flags |= SF_FINST_D;
|
||||
else
|
||||
s->flags |= SN_FINST_L;
|
||||
s->flags |= SF_FINST_L;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1303,7 +1303,7 @@ static void sess_prepare_conn_req(struct stream *s)
|
||||
* error code to ignore the ERR_LOCAL which is not a
|
||||
* real error.
|
||||
*/
|
||||
s->flags &= ~(SN_ERR_MASK | SN_FINST_MASK);
|
||||
s->flags &= ~(SF_ERR_MASK | SF_FINST_MASK);
|
||||
|
||||
si_shutr(si);
|
||||
si_shutw(si);
|
||||
@ -1372,7 +1372,7 @@ static int process_switching_rules(struct stream *s, struct channel *req, int an
|
||||
req->analysers);
|
||||
|
||||
/* now check whether we have some switching rules for this request */
|
||||
if (!(s->flags & SN_BE_ASSIGNED)) {
|
||||
if (!(s->flags & SF_BE_ASSIGNED)) {
|
||||
struct switching_rule *rule;
|
||||
|
||||
list_for_each_entry(rule, &s->fe->switching_rules, list) {
|
||||
@ -1414,7 +1414,7 @@ static int process_switching_rules(struct stream *s, struct channel *req, int an
|
||||
* measure also takes care of correctly setting the default
|
||||
* backend if any.
|
||||
*/
|
||||
if (!(s->flags & SN_BE_ASSIGNED))
|
||||
if (!(s->flags & SF_BE_ASSIGNED))
|
||||
if (!stream_set_backend(s, s->fe->defbe.be ? s->fe->defbe.be : s->be))
|
||||
goto sw_failed;
|
||||
}
|
||||
@ -1441,9 +1441,9 @@ static int process_switching_rules(struct stream *s, struct channel *req, int an
|
||||
if (ret) {
|
||||
/* no rule, or the rule matches */
|
||||
if (prst_rule->type == PERSIST_TYPE_FORCE) {
|
||||
s->flags |= SN_FORCE_PRST;
|
||||
s->flags |= SF_FORCE_PRST;
|
||||
} else {
|
||||
s->flags |= SN_IGNORE_PRST;
|
||||
s->flags |= SF_IGNORE_PRST;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1456,10 +1456,10 @@ static int process_switching_rules(struct stream *s, struct channel *req, int an
|
||||
channel_abort(&s->req);
|
||||
channel_abort(&s->res);
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_RESOURCE;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_R;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_RESOURCE;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_R;
|
||||
|
||||
s->txn.status = 500;
|
||||
s->req.analysers = 0;
|
||||
@ -1485,7 +1485,7 @@ static int process_server_rules(struct stream *s, struct channel *req, int an_bi
|
||||
req->buf->i + req->buf->o,
|
||||
req->analysers);
|
||||
|
||||
if (!(s->flags & SN_ASSIGNED)) {
|
||||
if (!(s->flags & SF_ASSIGNED)) {
|
||||
list_for_each_entry(rule, &px->server_rules, list) {
|
||||
int ret;
|
||||
|
||||
@ -1499,8 +1499,8 @@ static int process_server_rules(struct stream *s, struct channel *req, int an_bi
|
||||
|
||||
if ((srv->state != SRV_ST_STOPPED) ||
|
||||
(px->options & PR_O_PERSIST) ||
|
||||
(s->flags & SN_FORCE_PRST)) {
|
||||
s->flags |= SN_DIRECT | SN_ASSIGNED;
|
||||
(s->flags & SF_FORCE_PRST)) {
|
||||
s->flags |= SF_DIRECT | SF_ASSIGNED;
|
||||
s->target = &srv->obj_type;
|
||||
break;
|
||||
}
|
||||
@ -1571,7 +1571,7 @@ static int process_sticking_rules(struct stream *s, struct channel *req, int an_
|
||||
struct stksess *ts;
|
||||
|
||||
if ((ts = stktable_lookup_key(rule->table.t, key)) != NULL) {
|
||||
if (!(s->flags & SN_ASSIGNED)) {
|
||||
if (!(s->flags & SF_ASSIGNED)) {
|
||||
struct eb32_node *node;
|
||||
void *ptr;
|
||||
|
||||
@ -1584,8 +1584,8 @@ static int process_sticking_rules(struct stream *s, struct channel *req, int an_
|
||||
srv = container_of(node, struct server, conf.id);
|
||||
if ((srv->state != SRV_ST_STOPPED) ||
|
||||
(px->options & PR_O_PERSIST) ||
|
||||
(s->flags & SN_FORCE_PRST)) {
|
||||
s->flags |= SN_DIRECT | SN_ASSIGNED;
|
||||
(s->flags & SF_FORCE_PRST)) {
|
||||
s->flags |= SF_DIRECT | SF_ASSIGNED;
|
||||
s->target = &srv->obj_type;
|
||||
}
|
||||
}
|
||||
@ -1848,10 +1848,10 @@ struct task *process_stream(struct task *t)
|
||||
s->fe->fe_counters.cli_aborts++;
|
||||
if (srv)
|
||||
srv->counters.cli_aborts++;
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_CLICL;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_D;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_CLICL;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_D;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1869,10 +1869,10 @@ struct task *process_stream(struct task *t)
|
||||
s->fe->fe_counters.srv_aborts++;
|
||||
if (srv)
|
||||
srv->counters.srv_aborts++;
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_SRVCL;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_D;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_SRVCL;
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= SF_FINST_D;
|
||||
}
|
||||
}
|
||||
/* note: maybe we should process connection errors here ? */
|
||||
@ -1924,8 +1924,8 @@ struct task *process_stream(struct task *t)
|
||||
si_b->state = SI_ST_CLO;
|
||||
srv = objt_server(s->target);
|
||||
if (srv) {
|
||||
if (s->flags & SN_CURR_SESS) {
|
||||
s->flags &= ~SN_CURR_SESS;
|
||||
if (s->flags & SF_CURR_SESS) {
|
||||
s->flags &= ~SF_CURR_SESS;
|
||||
srv->cur_sess--;
|
||||
}
|
||||
sess_change_server(s, NULL);
|
||||
@ -2207,7 +2207,7 @@ struct task *process_stream(struct task *t)
|
||||
* seen any analyser who could set an error status.
|
||||
*/
|
||||
srv = objt_server(s->target);
|
||||
if (unlikely(!(s->flags & SN_ERR_MASK))) {
|
||||
if (unlikely(!(s->flags & SF_ERR_MASK))) {
|
||||
if (req->flags & (CF_READ_ERROR|CF_READ_TIMEOUT|CF_WRITE_ERROR|CF_WRITE_TIMEOUT)) {
|
||||
/* Report it if the client got an error or a read timeout expired */
|
||||
req->analysers = 0;
|
||||
@ -2216,28 +2216,28 @@ struct task *process_stream(struct task *t)
|
||||
s->fe->fe_counters.cli_aborts++;
|
||||
if (srv)
|
||||
srv->counters.cli_aborts++;
|
||||
s->flags |= SN_ERR_CLICL;
|
||||
s->flags |= SF_ERR_CLICL;
|
||||
}
|
||||
else if (req->flags & CF_READ_TIMEOUT) {
|
||||
s->be->be_counters.cli_aborts++;
|
||||
s->fe->fe_counters.cli_aborts++;
|
||||
if (srv)
|
||||
srv->counters.cli_aborts++;
|
||||
s->flags |= SN_ERR_CLITO;
|
||||
s->flags |= SF_ERR_CLITO;
|
||||
}
|
||||
else if (req->flags & CF_WRITE_ERROR) {
|
||||
s->be->be_counters.srv_aborts++;
|
||||
s->fe->fe_counters.srv_aborts++;
|
||||
if (srv)
|
||||
srv->counters.srv_aborts++;
|
||||
s->flags |= SN_ERR_SRVCL;
|
||||
s->flags |= SF_ERR_SRVCL;
|
||||
}
|
||||
else {
|
||||
s->be->be_counters.srv_aborts++;
|
||||
s->fe->fe_counters.srv_aborts++;
|
||||
if (srv)
|
||||
srv->counters.srv_aborts++;
|
||||
s->flags |= SN_ERR_SRVTO;
|
||||
s->flags |= SF_ERR_SRVTO;
|
||||
}
|
||||
sess_set_term_flags(s);
|
||||
}
|
||||
@ -2249,28 +2249,28 @@ struct task *process_stream(struct task *t)
|
||||
s->fe->fe_counters.srv_aborts++;
|
||||
if (srv)
|
||||
srv->counters.srv_aborts++;
|
||||
s->flags |= SN_ERR_SRVCL;
|
||||
s->flags |= SF_ERR_SRVCL;
|
||||
}
|
||||
else if (res->flags & CF_READ_TIMEOUT) {
|
||||
s->be->be_counters.srv_aborts++;
|
||||
s->fe->fe_counters.srv_aborts++;
|
||||
if (srv)
|
||||
srv->counters.srv_aborts++;
|
||||
s->flags |= SN_ERR_SRVTO;
|
||||
s->flags |= SF_ERR_SRVTO;
|
||||
}
|
||||
else if (res->flags & CF_WRITE_ERROR) {
|
||||
s->be->be_counters.cli_aborts++;
|
||||
s->fe->fe_counters.cli_aborts++;
|
||||
if (srv)
|
||||
srv->counters.cli_aborts++;
|
||||
s->flags |= SN_ERR_CLICL;
|
||||
s->flags |= SF_ERR_CLICL;
|
||||
}
|
||||
else {
|
||||
s->be->be_counters.cli_aborts++;
|
||||
s->fe->fe_counters.cli_aborts++;
|
||||
if (srv)
|
||||
srv->counters.cli_aborts++;
|
||||
s->flags |= SN_ERR_CLITO;
|
||||
s->flags |= SF_ERR_CLITO;
|
||||
}
|
||||
sess_set_term_flags(s);
|
||||
}
|
||||
@ -2423,7 +2423,7 @@ struct task *process_stream(struct task *t)
|
||||
}
|
||||
|
||||
srv = objt_server(s->target);
|
||||
if (si_b->state == SI_ST_ASS && srv && srv->rdr_len && (s->flags & SN_REDIRECTABLE))
|
||||
if (si_b->state == SI_ST_ASS && srv && srv->rdr_len && (s->flags & SF_REDIRECTABLE))
|
||||
http_perform_server_redirect(s, si_b);
|
||||
} while (si_b->state == SI_ST_ASS);
|
||||
}
|
||||
@ -2588,7 +2588,7 @@ struct task *process_stream(struct task *t)
|
||||
if (likely((si_f->state != SI_ST_CLO) ||
|
||||
(si_b->state > SI_ST_INI && si_b->state < SI_ST_CLO))) {
|
||||
|
||||
if ((s->fe->options & PR_O_CONTSTATS) && (s->flags & SN_BE_ASSIGNED))
|
||||
if ((s->fe->options & PR_O_CONTSTATS) && (s->flags & SF_BE_ASSIGNED))
|
||||
stream_process_counters(s);
|
||||
|
||||
if (si_f->state == SI_ST_EST && obj_type(si_f->end) != OBJ_TYPE_APPCTX)
|
||||
@ -2665,7 +2665,7 @@ struct task *process_stream(struct task *t)
|
||||
}
|
||||
|
||||
s->fe->feconn--;
|
||||
if (s->flags & SN_BE_ASSIGNED)
|
||||
if (s->flags & SF_BE_ASSIGNED)
|
||||
s->be->beconn--;
|
||||
jobs--;
|
||||
if (s->listener) {
|
||||
@ -2705,21 +2705,21 @@ struct task *process_stream(struct task *t)
|
||||
|
||||
if (s->fe->mode == PR_MODE_HTTP) {
|
||||
s->fe->fe_counters.p.http.rsp[n]++;
|
||||
if (s->comp_algo && (s->flags & SN_COMP_READY))
|
||||
if (s->comp_algo && (s->flags & SF_COMP_READY))
|
||||
s->fe->fe_counters.p.http.comp_rsp++;
|
||||
}
|
||||
if ((s->flags & SN_BE_ASSIGNED) &&
|
||||
if ((s->flags & SF_BE_ASSIGNED) &&
|
||||
(s->be->mode == PR_MODE_HTTP)) {
|
||||
s->be->be_counters.p.http.rsp[n]++;
|
||||
s->be->be_counters.p.http.cum_req++;
|
||||
if (s->comp_algo && (s->flags & SN_COMP_READY))
|
||||
if (s->comp_algo && (s->flags & SF_COMP_READY))
|
||||
s->be->be_counters.p.http.comp_rsp++;
|
||||
}
|
||||
}
|
||||
|
||||
/* let's do a final log if we need it */
|
||||
if (!LIST_ISEMPTY(&s->fe->logformat) && s->logs.logwait &&
|
||||
!(s->flags & SN_MONITOR) &&
|
||||
!(s->flags & SF_MONITOR) &&
|
||||
(!(s->fe->options & PR_O_NULLNOLOG) || req->total)) {
|
||||
s->do_log(s);
|
||||
}
|
||||
@ -2814,45 +2814,45 @@ void default_srv_error(struct stream *s, struct stream_interface *si)
|
||||
int err = 0, fin = 0;
|
||||
|
||||
if (err_type & SI_ET_QUEUE_ABRT) {
|
||||
err = SN_ERR_CLICL;
|
||||
fin = SN_FINST_Q;
|
||||
err = SF_ERR_CLICL;
|
||||
fin = SF_FINST_Q;
|
||||
}
|
||||
else if (err_type & SI_ET_CONN_ABRT) {
|
||||
err = SN_ERR_CLICL;
|
||||
fin = SN_FINST_C;
|
||||
err = SF_ERR_CLICL;
|
||||
fin = SF_FINST_C;
|
||||
}
|
||||
else if (err_type & SI_ET_QUEUE_TO) {
|
||||
err = SN_ERR_SRVTO;
|
||||
fin = SN_FINST_Q;
|
||||
err = SF_ERR_SRVTO;
|
||||
fin = SF_FINST_Q;
|
||||
}
|
||||
else if (err_type & SI_ET_QUEUE_ERR) {
|
||||
err = SN_ERR_SRVCL;
|
||||
fin = SN_FINST_Q;
|
||||
err = SF_ERR_SRVCL;
|
||||
fin = SF_FINST_Q;
|
||||
}
|
||||
else if (err_type & SI_ET_CONN_TO) {
|
||||
err = SN_ERR_SRVTO;
|
||||
fin = SN_FINST_C;
|
||||
err = SF_ERR_SRVTO;
|
||||
fin = SF_FINST_C;
|
||||
}
|
||||
else if (err_type & SI_ET_CONN_ERR) {
|
||||
err = SN_ERR_SRVCL;
|
||||
fin = SN_FINST_C;
|
||||
err = SF_ERR_SRVCL;
|
||||
fin = SF_FINST_C;
|
||||
}
|
||||
else if (err_type & SI_ET_CONN_RES) {
|
||||
err = SN_ERR_RESOURCE;
|
||||
fin = SN_FINST_C;
|
||||
err = SF_ERR_RESOURCE;
|
||||
fin = SF_FINST_C;
|
||||
}
|
||||
else /* SI_ET_CONN_OTHER and others */ {
|
||||
err = SN_ERR_INTERNAL;
|
||||
fin = SN_FINST_C;
|
||||
err = SF_ERR_INTERNAL;
|
||||
fin = SF_FINST_C;
|
||||
}
|
||||
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= err;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
if (!(s->flags & SF_FINST_MASK))
|
||||
s->flags |= fin;
|
||||
}
|
||||
|
||||
/* kill a stream and set the termination flags to <why> (one of SN_ERR_*) */
|
||||
/* kill a stream and set the termination flags to <why> (one of SF_ERR_*) */
|
||||
void stream_shutdown(struct stream *stream, int why)
|
||||
{
|
||||
if (stream->req.flags & (CF_SHUTW|CF_SHUTW_NOW))
|
||||
@ -2861,7 +2861,7 @@ void stream_shutdown(struct stream *stream, int why)
|
||||
channel_shutw_now(&stream->req);
|
||||
channel_shutr_now(&stream->res);
|
||||
stream->task->nice = 1024;
|
||||
if (!(stream->flags & SN_ERR_MASK))
|
||||
if (!(stream->flags & SF_ERR_MASK))
|
||||
stream->flags |= why;
|
||||
task_wakeup(stream->task, TASK_WOKEN_OTHER);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user