From: Willy Tarreau Date: Mon, 23 Jul 2012 17:19:51 +0000 (+0200) Subject: MEDIUM: stream_interface: centralize the SI_FL_ERR management X-Git-Tag: v1.5-dev12~105 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c55ec20202c3d3f872498cf527fe288ad94b515;p=thirdparty%2Fhaproxy.git MEDIUM: stream_interface: centralize the SI_FL_ERR management It's better to have only stream_sock_update_conn() handle the conversion of the CO_FL_ERROR flag to SI_FL_ERR than having it in each and every I/O callback. --- diff --git a/src/proto_tcp.c b/src/proto_tcp.c index cebc477107..c785384ec6 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -589,9 +589,7 @@ int tcp_connect_probe(struct connection *conn) */ conn->flags |= CO_FL_ERROR; - fdtab[fd].ev &= ~FD_POLL_STICKY; EV_FD_REM(fd); - si->flags |= SI_FL_ERR; retval = 1; goto out_wakeup; } diff --git a/src/sock_raw.c b/src/sock_raw.c index cdb0e27140..8136d601ca 100644 --- a/src/sock_raw.c +++ b/src/sock_raw.c @@ -467,9 +467,7 @@ static int sock_raw_read(struct connection *conn) */ conn->flags |= CO_FL_ERROR; - fdtab[fd].ev &= ~FD_POLL_STICKY; EV_FD_REM(fd); - si->flags |= SI_FL_ERR; retval = 1; goto out_wakeup; } @@ -662,9 +660,7 @@ static int sock_raw_write(struct connection *conn) */ conn->flags |= CO_FL_ERROR; - fdtab[fd].ev &= ~FD_POLL_STICKY; EV_FD_REM(fd); - si->flags |= SI_FL_ERR; return 1; } diff --git a/src/stream_interface.c b/src/stream_interface.c index 9d6f9616c4..1a6db199ac 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -498,6 +498,9 @@ void stream_sock_update_conn(struct connection *conn) __FUNCTION__, si, si->state, si->ib->flags, si->ob->flags); + if (conn->flags & CO_FL_ERROR) + si->flags |= SI_FL_ERR; + /* process consumer side, only once if possible */ if (fdtab[fd].ev & (FD_POLL_OUT | FD_POLL_ERR)) { if (si->ob->flags & BF_OUT_EMPTY) {