From: Willy Tarreau Date: Sun, 8 Mar 2009 19:33:29 +0000 (+0100) Subject: [CLEANUP] buffer_flush() was misleading, rename it as buffer_erase X-Git-Tag: v1.3.16-rc1~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f0aa476bd8ace7c74191301e3a2b7560acb21ed;p=thirdparty%2Fhaproxy.git [CLEANUP] buffer_flush() was misleading, rename it as buffer_erase --- diff --git a/include/proto/buffers.h b/include/proto/buffers.h index 6b5771b6ab..eab24f6a5a 100644 --- a/include/proto/buffers.h +++ b/include/proto/buffers.h @@ -108,11 +108,11 @@ static inline void buffer_forward(struct buffer *buf, unsigned int bytes) buf->send_max += data_left; } -/* Flush any content from buffer and adjusts flags accordingly. Note +/* Erase any content from buffer and adjusts flags accordingly. Note * that any spliced data is not affected since we may not have any access to * it. */ -static inline void buffer_flush(struct buffer *buf) +static inline void buffer_erase(struct buffer *buf) { buf->send_max = 0; buf->to_forward = 0; diff --git a/src/proto_http.c b/src/proto_http.c index 5204284419..0384996dea 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -540,13 +540,13 @@ int http_find_header(const char *name, * 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. * 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, int err, int finst, int status, const struct chunk *msg) { - buffer_flush(si->ob); - buffer_flush(si->ib); + buffer_erase(si->ob); + buffer_erase(si->ib); buffer_write_ena(si->ib); if (status > 0 && msg) { 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. */ if (txn->flags & TX_CLTARPIT) { - buffer_flush(s->req); - /* flush the request so that we can drop the connection early + buffer_erase(s->req); + /* wipe the request out so that we can drop the connection early * if the client closes first. */ buffer_write_dis(req); diff --git a/src/stream_interface.c b/src/stream_interface.c index c7f9b43e37..c0c80b6e13 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -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 - * output buffer doesn't need to be empty before this. The message is contained - * in a "chunk". If it is null, then an empty message is used. + * Erase any content from input and output buffers, and return a message into + * the output buffer. The message is provided as a "chunk". If it is null, + * then an empty message is used. */ void stream_int_return(struct stream_interface *si, const struct chunk *msg) { - buffer_flush(si->ib); - buffer_flush(si->ob); + buffer_erase(si->ib); + buffer_erase(si->ob); if (msg && 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) { buffer_abort(si->ib); - buffer_flush(si->ob); + buffer_erase(si->ob); buffer_shutr_now(si->ob); if (msg && msg->len) buffer_write(si->ob, msg->str, msg->len);