MINOR: receiver: link the receiver to its owner

A receiver will have to pass a context to be installed into the fdtab
for use by the handler. We need to set this into the receiver struct
as the bind will happen longer after the configuration.
This commit is contained in:
Willy Tarreau 2020-09-03 10:05:03 +02:00
parent 0fce6bce34
commit eef454224d
2 changed files with 2 additions and 0 deletions

View File

@ -47,6 +47,7 @@ struct receiver {
int fd; /* handle we receive from (fd only for now) */ int fd; /* handle we receive from (fd only for now) */
unsigned int flags; /* receiver options (RX_F_*) */ unsigned int flags; /* receiver options (RX_F_*) */
struct protocol *proto; /* protocol this receiver belongs to */ struct protocol *proto; /* protocol this receiver belongs to */
void *owner; /* receiver's owner (usually a listener) */
struct rx_settings *settings; /* points to the settings used by this receiver */ struct rx_settings *settings; /* points to the settings used by this receiver */
struct list proto_list; /* list in the protocol header */ struct list proto_list; /* list in the protocol header */
/* warning: this struct is huge, keep it at the bottom */ /* warning: this struct is huge, keep it at the bottom */

View File

@ -564,6 +564,7 @@ int create_listeners(struct bind_conf *bc, const struct sockaddr_storage *ss,
LIST_ADDQ(&bc->listeners, &l->by_bind); LIST_ADDQ(&bc->listeners, &l->by_bind);
l->bind_conf = bc; l->bind_conf = bc;
l->rx.settings = &bc->settings; l->rx.settings = &bc->settings;
l->rx.owner = l;
l->rx.fd = fd; l->rx.fd = fd;
memcpy(&l->rx.addr, ss, sizeof(*ss)); memcpy(&l->rx.addr, ss, sizeof(*ss));
MT_LIST_INIT(&l->wait_queue); MT_LIST_INIT(&l->wait_queue);