diff --git a/include/proto/connection.h b/include/proto/connection.h index 94f1c83b8..7f130d809 100644 --- a/include/proto/connection.h +++ b/include/proto/connection.h @@ -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; } diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h index f68b6ba06..c11ce3892 100644 --- a/include/proto/stream_interface.h +++ b/include/proto/stream_interface.h @@ -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 */ diff --git a/include/types/connection.h b/include/types/connection.h index 8a1b8ee50..66ab11800 100644 --- a/include/types/connection.h +++ b/include/types/connection.h @@ -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 */ };