]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: connection: perform the call to xprt->shutw() in conn_data_shutw()
authorWilly Tarreau <w@1wt.eu>
Thu, 12 Mar 2015 21:51:10 +0000 (22:51 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 12 Mar 2015 21:51:10 +0000 (22:51 +0100)
This will save callers from having to care about conn->xprt and xprt->shutw.
Note that shutw() takes a second argument indicating whether it's a clean or
a hard shutw. This is used by SSL which tries to close cleanly in most cases.

Here we provide two versions, conn_data_shutw() which performs the clean
close, and conn_data_shutw_hard() which does the unclean one.

include/proto/connection.h

index fc97f1c333de2cef42299321809d31d20a5d317d..5f80cc5ba4ca8dd4ce6e41a48db5e518beebd740 100644 (file)
@@ -420,6 +420,20 @@ static inline void conn_data_shutw(struct connection *c)
 {
        c->flags |= CO_FL_DATA_WR_SH;
        __conn_data_stop_send(c);
+
+       /* clean data-layer shutdown */
+       if (c->xprt && c->xprt->shutw)
+               c->xprt->shutw(c, 1);
+}
+
+static inline void conn_data_shutw_hard(struct connection *c)
+{
+       c->flags |= CO_FL_DATA_WR_SH;
+       __conn_data_stop_send(c);
+
+       /* unclean data-layer shutdown */
+       if (c->xprt && c->xprt->shutw)
+               c->xprt->shutw(c, 0);
 }
 
 /* detect sock->data read0 transition */