mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 13:51:26 +02:00
MINOR: connections: Add a new xprt method, add_xprt().
Add a new method to xprt_ops, add_xprt(), that changes the underlying xprt to the one provided, and optionally provide the old one.
This commit is contained in:
parent
5149b59851
commit
2e055483ff
@ -334,6 +334,7 @@ struct xprt_ops {
|
|||||||
int (*subscribe)(struct connection *conn, void *xprt_ctx, int event_type, void *param); /* Subscribe to events, such as "being able to send" */
|
int (*subscribe)(struct connection *conn, void *xprt_ctx, int event_type, void *param); /* Subscribe to events, such as "being able to send" */
|
||||||
int (*unsubscribe)(struct connection *conn, void *xprt_ctx, int event_type, void *param); /* Unsubscribe to events */
|
int (*unsubscribe)(struct connection *conn, void *xprt_ctx, int event_type, void *param); /* Unsubscribe to events */
|
||||||
int (*remove_xprt)(struct connection *conn, void *xprt_ctx, void *toremove_ctx, const struct xprt_ops *newops, void *newctx); /* Remove an xprt from the connection, used by temporary xprt such as the handshake one */
|
int (*remove_xprt)(struct connection *conn, void *xprt_ctx, void *toremove_ctx, const struct xprt_ops *newops, void *newctx); /* Remove an xprt from the connection, used by temporary xprt such as the handshake one */
|
||||||
|
int (*add_xprt)(struct connection *conn, void *xprt_ctx, void *toadd_ctx, const struct xprt_ops *toadd_ops, void **oldxprt_ctx, const struct xprt_ops **oldxprt_ops); /* Add a new XPRT as the new xprt, and return the old one */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* mux_ops describes the mux operations, which are to be performed at the
|
/* mux_ops describes the mux operations, which are to be performed at the
|
||||||
|
@ -5630,6 +5630,22 @@ static int ssl_unsubscribe(struct connection *conn, void *xprt_ctx, int event_ty
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Use the provided XPRT as an underlying XPRT, and provide the old one.
|
||||||
|
* Returns 0 on success, and non-zero on failure.
|
||||||
|
*/
|
||||||
|
static int ssl_add_xprt(struct connection *conn, void *xprt_ctx, void *toadd_ctx, const struct xprt_ops *toadd_ops, void **oldxprt_ctx, const struct xprt_ops **oldxprt_ops)
|
||||||
|
{
|
||||||
|
struct ssl_sock_ctx *ctx = xprt_ctx;
|
||||||
|
|
||||||
|
if (oldxprt_ops != NULL)
|
||||||
|
*oldxprt_ops = ctx->xprt;
|
||||||
|
if (oldxprt_ctx != NULL)
|
||||||
|
*oldxprt_ctx = ctx->xprt_ctx;
|
||||||
|
ctx->xprt = toadd_ops;
|
||||||
|
ctx->xprt_ctx = toadd_ctx;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove the specified xprt. If if it our underlying XPRT, remove it and
|
/* Remove the specified xprt. If if it our underlying XPRT, remove it and
|
||||||
* return 0, otherwise just call the remove_xprt method from the underlying
|
* return 0, otherwise just call the remove_xprt method from the underlying
|
||||||
* XPRT.
|
* XPRT.
|
||||||
@ -9842,6 +9858,7 @@ static struct xprt_ops ssl_sock = {
|
|||||||
.subscribe = ssl_subscribe,
|
.subscribe = ssl_subscribe,
|
||||||
.unsubscribe = ssl_unsubscribe,
|
.unsubscribe = ssl_unsubscribe,
|
||||||
.remove_xprt = ssl_remove_xprt,
|
.remove_xprt = ssl_remove_xprt,
|
||||||
|
.add_xprt = ssl_add_xprt,
|
||||||
.rcv_pipe = NULL,
|
.rcv_pipe = NULL,
|
||||||
.snd_pipe = NULL,
|
.snd_pipe = NULL,
|
||||||
.shutr = NULL,
|
.shutr = NULL,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user