MINOR: protocol: register the receiver's I/O handler and not the protocol's

Now we define a new sock_accept_iocb() for socket-based stream protocols
and use it as a wrapper for listener_accept() which now takes a listener
and not an FD anymore. This will allow the receiver's I/O cb to be
redefined during registration, and more specifically to get rid of the
hard-coded hacks in protocol_bind_all() made for syslog.

The previous ->accept() callback in the protocol was removed since it
doesn't have anything to do with accept() anymore but is more generic.
A few places where listener_accept() was compared against the FD's IO
callback for debugging purposes on the CLI were updated.
This commit is contained in:
Willy Tarreau
2020-10-15 21:29:49 +02:00
parent e140a6921f
commit a74cb38e7c
12 changed files with 35 additions and 23 deletions

View File

@@ -2455,7 +2455,7 @@ void deinit(void)
if (!fdtab || !fdtab[cur_fd].owner)
continue;
if (fdtab[cur_fd].iocb == listener_accept) {
if (fdtab[cur_fd].iocb == &sock_accept_iocb) {
struct listener *l = fdtab[cur_fd].owner;
BUG_ON(l->state != LI_INIT);