[MINOR] replace the ambiguous client_return function by stream_int_return

This one applies to a stream interface, which makes more sense.
This commit is contained in:
Willy Tarreau 2008-11-30 19:22:53 +01:00
parent a5555ec68a
commit 81acfab4fd
6 changed files with 21 additions and 24 deletions

View File

@ -66,7 +66,6 @@ int process_request(struct session *t);
int process_response(struct session *t);
void client_retnclose(struct session *s, const struct chunk *msg);
void client_return(struct session *s, const struct chunk *msg);
void srv_close_with_err(struct session *t, int err, int finst,
int status, const struct chunk *msg);

View File

@ -28,7 +28,6 @@
#include <types/session.h>
void client_retnclose(struct session *s, const struct chunk *msg);
void client_return(struct session *s, const struct chunk *msg);
#endif /* _PROTO_SENDDATA_H */

View File

@ -31,6 +31,7 @@
/* main event functions used to move data between sockets and buffers */
void stream_int_check_timeouts(struct stream_interface *si);
void stream_int_report_error(struct stream_interface *si);
void stream_int_return(struct stream_interface *si, const struct chunk *msg);
#endif /* _PROTO_STREAM_INTERFACE_H */

View File

@ -549,7 +549,7 @@ void srv_close_with_err(struct session *t, int err, int finst,
if (status > 0 && msg) {
t->txn.status = status;
if (t->fe->mode == PR_MODE_HTTP)
client_return(t, msg);
stream_int_return(t->rep->cons, msg);
}
if (!(t->flags & SN_ERR_MASK))
t->flags |= err;
@ -2675,7 +2675,7 @@ int process_response(struct session *t)
t->be->failed_resp++;
rep->analysers = 0;
txn->status = 502;
client_return(t, error_message(t, HTTP_ERR_502));
stream_int_return(rep->cons, error_message(t, HTTP_ERR_502));
if (!(t->flags & SN_ERR_MASK))
t->flags |= SN_ERR_PRXCOND;
if (!(t->flags & SN_FINST_MASK))
@ -2704,7 +2704,7 @@ int process_response(struct session *t)
//t->be->failed_resp++;
rep->analysers = 0;
txn->status = 502;
client_return(t, error_message(t, HTTP_ERR_502));
stream_int_return(rep->cons, error_message(t, HTTP_ERR_502));
if (!(t->flags & SN_ERR_MASK))
t->flags |= SN_ERR_SRVCL;
if (!(t->flags & SN_FINST_MASK))
@ -2729,7 +2729,7 @@ int process_response(struct session *t)
t->be->failed_resp++;
rep->analysers = 0;
txn->status = 504;
client_return(t, error_message(t, HTTP_ERR_504));
stream_int_return(rep->cons, error_message(t, HTTP_ERR_504));
if (!(t->flags & SN_ERR_MASK))
t->flags |= SN_ERR_SRVTO;
if (!(t->flags & SN_FINST_MASK))
@ -2753,7 +2753,7 @@ int process_response(struct session *t)
t->be->failed_resp++;
rep->analysers = 0;
txn->status = 502;
client_return(t, error_message(t, HTTP_ERR_502));
stream_int_return(rep->cons, error_message(t, HTTP_ERR_502));
if (!(t->flags & SN_ERR_MASK))
t->flags |= SN_ERR_SRVCL;
if (!(t->flags & SN_FINST_MASK))
@ -2853,7 +2853,7 @@ int process_response(struct session *t)
//req->cons->state = SI_ST_CLO;
rep->analysers = 0;
txn->status = 502;
client_return(t, error_message(t, HTTP_ERR_502));
stream_int_return(rep->cons, error_message(t, HTTP_ERR_502));
if (!(t->flags & SN_ERR_MASK))
t->flags |= SN_ERR_PRXCOND;
if (!(t->flags & SN_FINST_MASK))

View File

@ -63,21 +63,6 @@ void client_retnclose(struct session *s, const struct chunk *msg)
buffer_write_ena(s->rep);
}
/*
* returns a message into the rep buffer, and flushes the req buffer.
* The reply 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.
*/
void client_return(struct session *s, const struct chunk *msg)
{
buffer_flush(s->req);
buffer_flush(s->rep);
if (msg && msg->len)
buffer_write(s->rep, msg->str, msg->len);
}
/*
* Local variables:
* c-indent-level: 8

View File

@ -58,6 +58,19 @@ void stream_int_report_error(struct stream_interface *si)
si->ib->flags |= BF_READ_ERROR;
}
/*
* 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.
*/
void stream_int_return(struct stream_interface *si, const struct chunk *msg)
{
buffer_flush(si->ib);
buffer_flush(si->ob);
if (msg && msg->len)
buffer_write(si->ob, msg->str, msg->len);
}
/*
* Local variables:
* c-indent-level: 8