From 34ffd776487d6718385030ab9c1696df7abda5ee Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 3 Sep 2012 16:51:27 +0200 Subject: [PATCH] MAJOR: stream_interface: continue to update data polling flags during handshakes Since data and socket polling flags were split, it became possible to update data flags even during handshakes. In fact this is very important otherwise it is not possible to poll for writes if some data are to be forwarded during a handshake (eg: data received during an SSL connect). --- src/stream_interface.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/src/stream_interface.c b/src/stream_interface.c index 8d7c24ba6..8037fb768 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -750,11 +750,6 @@ void stream_int_update_conn(struct stream_interface *si) struct channel *ib = si->ib; struct channel *ob = si->ob; - if (si->conn.flags & CO_FL_HANDSHAKE) { - /* a handshake is in progress */ - return; - } - /* Check if we need to close the read side */ if (!(ib->flags & CF_SHUTR)) { /* Read not closed, update FD status and timeout for reads */ @@ -826,14 +821,9 @@ static void stream_int_chk_rcv_conn(struct stream_interface *si) { struct channel *ib = si->ib; - if (unlikely(si->state != SI_ST_EST || (ib->flags & CF_SHUTR))) + if (unlikely(si->state > SI_ST_EST || (ib->flags & CF_SHUTR))) return; - if (si->conn.flags & CO_FL_HANDSHAKE) { - /* a handshake is in progress */ - return; - } - if ((ib->flags & (CF_HIJACK|CF_DONT_READ)) || channel_full(ib)) { /* stop reading */ if (!(ib->flags & (CF_HIJACK|CF_DONT_READ))) /* full */ @@ -857,15 +847,9 @@ static void stream_int_chk_snd_conn(struct stream_interface *si) { struct channel *ob = si->ob; - if (unlikely(si->state != SI_ST_EST || (ob->flags & CF_SHUTW))) + if (unlikely(si->state > SI_ST_EST || (ob->flags & CF_SHUTW))) return; - /* handshake running on producer */ - if (si->conn.flags & CO_FL_HANDSHAKE) { - /* a handshake is in progress */ - return; - } - if (unlikely(channel_is_empty(ob))) /* called with nothing to send ! */ return; @@ -874,7 +858,7 @@ static void stream_int_chk_snd_conn(struct stream_interface *si) (fdtab[si_fd(si)].ev & FD_POLL_OUT))) /* we'll be called anyway */ return; - if (si_conn_send_loop(&si->conn) < 0) { + if (!(si->conn.flags & CO_FL_HANDSHAKE) && si_conn_send_loop(&si->conn) < 0) { /* Write error on the file descriptor. We mark the FD as STERROR so * that we don't use it anymore and we notify the task. */