mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
[MEDIUM] buffers: add BF_READ_ATTACHED and BF_ANA_TIMEOUT
Those two flags will be used to wake up analysers only when needed.
This commit is contained in:
parent
48adac5db9
commit
9a2d15429d
@ -54,8 +54,6 @@
|
|||||||
#define BF_READ_TIMEOUT 0x000004 /* timeout while waiting for producer */
|
#define BF_READ_TIMEOUT 0x000004 /* timeout while waiting for producer */
|
||||||
#define BF_READ_ERROR 0x000008 /* unrecoverable error on producer side */
|
#define BF_READ_ERROR 0x000008 /* unrecoverable error on producer side */
|
||||||
#define BF_READ_ACTIVITY (BF_READ_NULL|BF_READ_PARTIAL|BF_READ_ERROR)
|
#define BF_READ_ACTIVITY (BF_READ_NULL|BF_READ_PARTIAL|BF_READ_ERROR)
|
||||||
#define BF_READ_STATUS (BF_READ_NULL|BF_READ_PARTIAL|BF_READ_ERROR|BF_READ_TIMEOUT)
|
|
||||||
#define BF_CLEAR_READ (~BF_READ_STATUS)
|
|
||||||
|
|
||||||
#define BF_FULL 0x000010 /* buffer cannot accept any more data (l >= rlim-data) */
|
#define BF_FULL 0x000010 /* buffer cannot accept any more data (l >= rlim-data) */
|
||||||
#define BF_SHUTR 0x000020 /* producer has already shut down */
|
#define BF_SHUTR 0x000020 /* producer has already shut down */
|
||||||
@ -67,8 +65,6 @@
|
|||||||
#define BF_WRITE_TIMEOUT 0x000400 /* timeout while waiting for consumer */
|
#define BF_WRITE_TIMEOUT 0x000400 /* timeout while waiting for consumer */
|
||||||
#define BF_WRITE_ERROR 0x000800 /* unrecoverable error on consumer side */
|
#define BF_WRITE_ERROR 0x000800 /* unrecoverable error on consumer side */
|
||||||
#define BF_WRITE_ACTIVITY (BF_WRITE_NULL|BF_WRITE_PARTIAL|BF_WRITE_ERROR)
|
#define BF_WRITE_ACTIVITY (BF_WRITE_NULL|BF_WRITE_PARTIAL|BF_WRITE_ERROR)
|
||||||
#define BF_WRITE_STATUS (BF_WRITE_NULL|BF_WRITE_PARTIAL|BF_WRITE_ERROR|BF_WRITE_TIMEOUT)
|
|
||||||
#define BF_CLEAR_WRITE (~BF_WRITE_STATUS)
|
|
||||||
|
|
||||||
#define BF_EMPTY 0x001000 /* buffer is empty */
|
#define BF_EMPTY 0x001000 /* buffer is empty */
|
||||||
#define BF_SHUTW 0x002000 /* consumer has already shut down */
|
#define BF_SHUTW 0x002000 /* consumer has already shut down */
|
||||||
@ -84,14 +80,21 @@
|
|||||||
* buffer.
|
* buffer.
|
||||||
*/
|
*/
|
||||||
#define BF_HIJACK 0x040000 /* the producer is temporarily replaced */
|
#define BF_HIJACK 0x040000 /* the producer is temporarily replaced */
|
||||||
|
#define BF_ANA_TIMEOUT 0x080000 /* the analyser timeout has expired */
|
||||||
|
#define BF_READ_ATTACHED 0x100000 /* the read side is attached for the first time */
|
||||||
|
|
||||||
|
/* Use these masks to clear the flags before going back to lower layers */
|
||||||
|
#define BF_CLEAR_READ (~(BF_READ_NULL|BF_READ_PARTIAL|BF_READ_ERROR|BF_READ_ATTACHED))
|
||||||
|
#define BF_CLEAR_WRITE (~(BF_WRITE_NULL|BF_WRITE_PARTIAL|BF_WRITE_ERROR))
|
||||||
|
#define BF_CLEAR_TIMEOUT (~(BF_READ_TIMEOUT|BF_WRITE_TIMEOUT|BF_ANA_TIMEOUT))
|
||||||
|
|
||||||
/* Masks which define input bits for stream interfaces and stream analysers */
|
/* Masks which define input bits for stream interfaces and stream analysers */
|
||||||
#define BF_MASK_INTERFACE_I (BF_FULL|BF_HIJACK|BF_READ_ENA|BF_READ_STATUS|BF_SHUTR_NOW|BF_SHUTR|BF_SHUTW)
|
#define BF_MASK_INTERFACE_I (BF_FULL|BF_HIJACK|BF_READ_ENA|BF_READ_ACTIVITY|BF_READ_TIMEOUT|BF_SHUTR_NOW|BF_SHUTR|BF_SHUTW)
|
||||||
#define BF_MASK_INTERFACE_O (BF_EMPTY|BF_HIJACK|BF_WRITE_ENA|BF_WRITE_STATUS|BF_SHUTW_NOW|BF_SHUTR|BF_SHUTW)
|
#define BF_MASK_INTERFACE_O (BF_EMPTY|BF_HIJACK|BF_WRITE_ENA|BF_WRITE_ACTIVITY|BF_WRITE_TIMEOUT|BF_SHUTW_NOW|BF_SHUTR|BF_SHUTW)
|
||||||
#define BF_MASK_INTERFACE (BF_MASK_INTF_I | BF_MASK_INTF_O)
|
#define BF_MASK_INTERFACE (BF_MASK_INTF_I | BF_MASK_INTF_O)
|
||||||
|
|
||||||
#define BF_MASK_ANALYSER (BF_FULL|BF_READ_STATUS|BF_SHUTR|BF_WRITE_ERROR)
|
#define BF_MASK_ANALYSER (BF_FULL|BF_READ_ACTIVITY|BF_READ_TIMEOUT|BF_ANA_TIMEOUT|BF_SHUTR|BF_READ_ATTACHED|BF_WRITE_ERROR)
|
||||||
#define BF_MASK_HIJACKER (BF_FULL|BF_WRITE_STATUS|BF_WRITE_TIMEOUT|BF_SHUTW)
|
#define BF_MASK_HIJACKER (BF_FULL|BF_WRITE_ACTIVITY|BF_WRITE_TIMEOUT|BF_SHUTW)
|
||||||
|
|
||||||
|
|
||||||
/* Analysers (buffer->analysers).
|
/* Analysers (buffer->analysers).
|
||||||
|
@ -342,6 +342,8 @@ int event_accept(int fd) {
|
|||||||
s->req->cons = &s->si[1];
|
s->req->cons = &s->si[1];
|
||||||
s->si[0].ib = s->si[1].ob = s->req;
|
s->si[0].ib = s->si[1].ob = s->req;
|
||||||
|
|
||||||
|
s->req->flags |= BF_READ_ATTACHED; /* the producer is already connected */
|
||||||
|
|
||||||
if (p->mode == PR_MODE_HTTP) /* reserve some space for header rewriting */
|
if (p->mode == PR_MODE_HTTP) /* reserve some space for header rewriting */
|
||||||
s->req->rlim -= MAXREWRITE;
|
s->req->rlim -= MAXREWRITE;
|
||||||
|
|
||||||
|
@ -869,8 +869,8 @@ void process_session(struct task *t, int *next)
|
|||||||
if (s->req->cons->state == SI_ST_EST)
|
if (s->req->cons->state == SI_ST_EST)
|
||||||
stream_sock_data_finish(s->req->cons->fd);
|
stream_sock_data_finish(s->req->cons->fd);
|
||||||
|
|
||||||
s->req->flags &= BF_CLEAR_READ & BF_CLEAR_WRITE;
|
s->req->flags &= BF_CLEAR_READ & BF_CLEAR_WRITE & BF_CLEAR_TIMEOUT;
|
||||||
s->rep->flags &= BF_CLEAR_READ & BF_CLEAR_WRITE;
|
s->rep->flags &= BF_CLEAR_READ & BF_CLEAR_WRITE & BF_CLEAR_TIMEOUT;
|
||||||
s->si[0].prev_state = s->si[0].state;
|
s->si[0].prev_state = s->si[0].state;
|
||||||
s->si[1].prev_state = s->si[1].state;
|
s->si[1].prev_state = s->si[1].state;
|
||||||
|
|
||||||
@ -3683,8 +3683,7 @@ int tcp_connection_status(struct session *t)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rep->analysers)
|
rep->flags |= BF_READ_ATTACHED; /* producer is now attached */
|
||||||
buffer_write_ena(t->rep);
|
|
||||||
req->wex = TICK_ETERNITY;
|
req->wex = TICK_ETERNITY;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user