mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-23 14:51:27 +02:00
MINOR: connection: add a pointer to the connection owner
This will be needed to find the stream interface from the connection once they're detached, but in the more immediate term, we'll need this for health checks since they don't use a stream interface.
This commit is contained in:
parent
82569f9158
commit
cd379950a7
@ -413,14 +413,16 @@ static inline void conn_get_to_addr(struct connection *conn)
|
||||
}
|
||||
|
||||
/* prepares a connection with the appropriate app_cb, ctrl and data layers. The
|
||||
* data state and context are set to 0.
|
||||
* data state and context are set to 0, and the connection's owner is set.
|
||||
*/
|
||||
static inline void conn_prepare(struct connection *conn, const struct app_cb *app,
|
||||
const struct protocol *ctrl, const struct data_ops *data)
|
||||
const struct protocol *ctrl, const struct data_ops *data,
|
||||
void *owner)
|
||||
{
|
||||
conn->app_cb = app;
|
||||
conn->ctrl = ctrl;
|
||||
conn->data = data;
|
||||
conn->owner = owner;
|
||||
conn->data_st = 0;
|
||||
conn->data_ctx = NULL;
|
||||
}
|
||||
|
@ -67,19 +67,19 @@ static inline int si_fd(struct stream_interface *si)
|
||||
static inline void si_prepare_conn(struct stream_interface *si, const struct protocol *ctrl, const struct data_ops *ops)
|
||||
{
|
||||
si->ops = &si_conn_ops;
|
||||
conn_prepare(&si->conn, &si_conn_cb, ctrl, ops);
|
||||
conn_prepare(&si->conn, &si_conn_cb, ctrl, ops, si);
|
||||
}
|
||||
|
||||
static inline void si_prepare_embedded(struct stream_interface *si)
|
||||
{
|
||||
si->ops = &si_embedded_ops;
|
||||
conn_prepare(&si->conn, NULL, NULL, NULL);
|
||||
conn_prepare(&si->conn, NULL, NULL, NULL, si);
|
||||
}
|
||||
|
||||
static inline void si_prepare_task(struct stream_interface *si)
|
||||
{
|
||||
si->ops = &si_task_ops;
|
||||
conn_prepare(&si->conn, NULL, NULL, NULL);
|
||||
conn_prepare(&si->conn, NULL, NULL, NULL, si);
|
||||
}
|
||||
|
||||
/* Sends a shutr to the connection using the data layer */
|
||||
|
@ -198,6 +198,7 @@ struct connection {
|
||||
const struct data_ops *data; /* operations at the data layer */
|
||||
const struct protocol *ctrl; /* operations at the socket layer */
|
||||
const struct app_cb *app_cb; /* application layer callbacks */
|
||||
void *owner; /* pointer to upper layer's entity (eg: stream interface) */
|
||||
union { /* definitions which depend on connection type */
|
||||
struct { /*** information used by socket-based connections ***/
|
||||
int fd; /* file descriptor for a stream driver when known */
|
||||
@ -209,7 +210,7 @@ struct connection {
|
||||
struct target target; /* the target to connect to (server, proxy, applet, ...) */
|
||||
struct {
|
||||
struct sockaddr_storage from; /* client address, or address to spoof when connecting to the server */
|
||||
struct sockaddr_storage to; /* address reached by the client if SN_FRT_ADDR_SET is set, or address to connect to */
|
||||
struct sockaddr_storage to; /* address reached by the client, or address to connect to */
|
||||
} addr; /* addresses of the remote side, client for producer and server for consumer */
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user