mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-20 21:31:28 +02:00
[CLEANUP] buffer_flush() was misleading, rename it as buffer_erase
This commit is contained in:
parent
ed066fae25
commit
6f0aa476bd
@ -108,11 +108,11 @@ static inline void buffer_forward(struct buffer *buf, unsigned int bytes)
|
|||||||
buf->send_max += data_left;
|
buf->send_max += data_left;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flush any content from buffer <buf> and adjusts flags accordingly. Note
|
/* Erase any content from buffer <buf> and adjusts flags accordingly. Note
|
||||||
* that any spliced data is not affected since we may not have any access to
|
* that any spliced data is not affected since we may not have any access to
|
||||||
* it.
|
* it.
|
||||||
*/
|
*/
|
||||||
static inline void buffer_flush(struct buffer *buf)
|
static inline void buffer_erase(struct buffer *buf)
|
||||||
{
|
{
|
||||||
buf->send_max = 0;
|
buf->send_max = 0;
|
||||||
buf->to_forward = 0;
|
buf->to_forward = 0;
|
||||||
|
@ -540,13 +540,13 @@ int http_find_header(const char *name,
|
|||||||
* stream interface is assumed to be already in a closed state. An optional
|
* stream interface is assumed to be already in a closed state. An optional
|
||||||
* message is copied into the input buffer, and an HTTP status code stored.
|
* message is copied into the input buffer, and an HTTP status code stored.
|
||||||
* The error flags are set to the values in arguments. Any pending request
|
* The error flags are set to the values in arguments. Any pending request
|
||||||
* is flushed.
|
* in this buffer will be lost.
|
||||||
*/
|
*/
|
||||||
static void http_server_error(struct session *t, struct stream_interface *si,
|
static void http_server_error(struct session *t, struct stream_interface *si,
|
||||||
int err, int finst, int status, const struct chunk *msg)
|
int err, int finst, int status, const struct chunk *msg)
|
||||||
{
|
{
|
||||||
buffer_flush(si->ob);
|
buffer_erase(si->ob);
|
||||||
buffer_flush(si->ib);
|
buffer_erase(si->ib);
|
||||||
buffer_write_ena(si->ib);
|
buffer_write_ena(si->ib);
|
||||||
if (status > 0 && msg) {
|
if (status > 0 && msg) {
|
||||||
t->txn.status = status;
|
t->txn.status = status;
|
||||||
@ -2304,8 +2304,8 @@ int http_process_request(struct session *s, struct buffer *req)
|
|||||||
* eventually expire. We build the tarpit as an analyser.
|
* eventually expire. We build the tarpit as an analyser.
|
||||||
*/
|
*/
|
||||||
if (txn->flags & TX_CLTARPIT) {
|
if (txn->flags & TX_CLTARPIT) {
|
||||||
buffer_flush(s->req);
|
buffer_erase(s->req);
|
||||||
/* flush the request so that we can drop the connection early
|
/* wipe the request out so that we can drop the connection early
|
||||||
* if the client closes first.
|
* if the client closes first.
|
||||||
*/
|
*/
|
||||||
buffer_write_dis(req);
|
buffer_write_dis(req);
|
||||||
|
@ -59,14 +59,14 @@ void stream_int_report_error(struct stream_interface *si)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns a message into the output buffer, and flushes the input buffer. The
|
* Erase any content from input and output buffers, and return a message into
|
||||||
* output buffer doesn't need to be empty before this. The message is contained
|
* the output buffer. The message is provided as a "chunk". If it is null,
|
||||||
* in a "chunk". If it is null, then an empty message is used.
|
* then an empty message is used.
|
||||||
*/
|
*/
|
||||||
void stream_int_return(struct stream_interface *si, const struct chunk *msg)
|
void stream_int_return(struct stream_interface *si, const struct chunk *msg)
|
||||||
{
|
{
|
||||||
buffer_flush(si->ib);
|
buffer_erase(si->ib);
|
||||||
buffer_flush(si->ob);
|
buffer_erase(si->ob);
|
||||||
if (msg && msg->len)
|
if (msg && msg->len)
|
||||||
buffer_write(si->ob, msg->str, msg->len);
|
buffer_write(si->ob, msg->str, msg->len);
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ void stream_int_return(struct stream_interface *si, const struct chunk *msg)
|
|||||||
void stream_int_retnclose(struct stream_interface *si, const struct chunk *msg)
|
void stream_int_retnclose(struct stream_interface *si, const struct chunk *msg)
|
||||||
{
|
{
|
||||||
buffer_abort(si->ib);
|
buffer_abort(si->ib);
|
||||||
buffer_flush(si->ob);
|
buffer_erase(si->ob);
|
||||||
buffer_shutr_now(si->ob);
|
buffer_shutr_now(si->ob);
|
||||||
if (msg && msg->len)
|
if (msg && msg->len)
|
||||||
buffer_write(si->ob, msg->str, msg->len);
|
buffer_write(si->ob, msg->str, msg->len);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user