]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream_interface: add a data channel close function
authorWilly Tarreau <w@1wt.eu>
Mon, 21 May 2012 15:28:50 +0000 (17:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 21 May 2012 15:59:53 +0000 (17:59 +0200)
This function will be called later when splitting the shutdown in two
steps. It will be needed by SSL and for remote socket operations to
release unused contexts.

include/proto/stream_interface.h
include/types/stream_interface.h
src/sock_raw.c
src/stream_interface.c

index 632300a9eca22b6d9e89877365f66cf2966bd149..efdb1c48b1f9106e3d8da1e661d9fdbb04fcc3c0 100644 (file)
@@ -189,6 +189,13 @@ static inline int si_connect(struct stream_interface *si)
        return si_ctrl(si)->connect(si);
 }
 
+/* Calls the close() function of the data layer if any */
+static inline void si_data_close(struct stream_interface *si)
+{
+       if (si->conn.data->close)
+               si->conn.data->close(&si->conn);
+}
+
 #endif /* _PROTO_STREAM_INTERFACE_H */
 
 /*
index 2afefb5ebd5ff0689f3c7f7959d6d06baa5556b0..8e9e64b1182d9678df0bae511883c5fb105674be 100644 (file)
@@ -132,7 +132,9 @@ struct sock_ops {
        void (*chk_rcv)(struct stream_interface *); /* chk_rcv function */
        void (*chk_snd)(struct stream_interface *); /* chk_snd function */
        int (*read)(int fd);                        /* read callback after poll() */
-       int (*write)(int fd);                       /* wrtie callback after poll() */
+       int (*write)(int fd);                       /* write callback after poll() */
+       void (*close)(struct connection *);         /* close the data channel on the connection */
+
 };
 
 /* A stream interface has 3 parts :
index 1205b2e49b52675c02436609a08bc81b302c0fbe..213d46972ca427ea9ea418ad6ef630f5d8c0ad6e 100644 (file)
@@ -1088,6 +1088,7 @@ struct sock_ops sock_raw = {
        .chk_snd = sock_raw_chk_snd,
        .read    = sock_raw_read,
        .write   = sock_raw_write,
+       .close   = NULL,
 };
 
 /*
index 1005eafa16bcfbedb4a34f6a0404daf2338b3770..c2f7b94f49c55ab392b31d3dd6b7cdd87eb16555 100644 (file)
@@ -49,6 +49,7 @@ struct sock_ops stream_int_embedded = {
        .chk_snd = stream_int_chk_snd,
        .read    = NULL,
        .write   = NULL,
+       .close   = NULL,
 };
 
 /* socket operations for external tasks */
@@ -60,6 +61,7 @@ struct sock_ops stream_int_task = {
        .chk_snd = stream_int_chk_snd,
        .read    = NULL,
        .write   = NULL,
+       .close   = NULL,
 };
 
 /*