]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: raw_sock: Add a close method.
authorOlivier Houchard <cognet@ci0.org>
Sat, 13 Mar 2021 23:34:49 +0000 (00:34 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 19 Mar 2021 14:33:04 +0000 (15:33 +0100)
Add a close() method, that explicitely cancels any subscription on the
connection, in preparation for future evolutions.

src/raw_sock.c

index 1900a5c4a86d76a70cc5b303bb7254c8208e1266..4fbc1a521aa18c4bc90d7b573fdf186a80013f45 100644 (file)
@@ -434,6 +434,13 @@ static int raw_sock_unsubscribe(struct connection *conn, void *xprt_ctx, int eve
        return conn_unsubscribe(conn, xprt_ctx, event_type, es);
 }
 
+static void raw_sock_close(struct connection *conn, void *xprt_ctx)
+{
+       if (conn->subs != NULL) {
+               conn_unsubscribe(conn, NULL, conn->subs->events, conn->subs);
+       }
+}
+
 /* We can't have an underlying XPRT, so just return -1 to signify failure */
 static int raw_sock_remove_xprt(struct connection *conn, void *xprt_ctx, void *toremove_ctx, const struct xprt_ops *newops, void *newctx)
 {
@@ -457,7 +464,7 @@ static struct xprt_ops raw_sock = {
 #endif
        .shutr    = NULL,
        .shutw    = NULL,
-       .close    = NULL,
+       .close    = raw_sock_close,
        .name     = "RAW",
 };