MEDIUM: fd: replace usages of fd_remove() with fd_stop_both()
authorWilly Tarreau <w@1wt.eu>
Wed, 26 Aug 2020 09:44:17 +0000 (11:44 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 26 Aug 2020 16:33:52 +0000 (18:33 +0200)
commit67672459c72328047c5b24c8a721789fef8b13d9
treef03cb3dc4152c6e719575cb2ea5ca1c634ffabc4
parenta78f3f0d79dc68bb42c2944439202f7cff40cc7f
MEDIUM: fd: replace usages of fd_remove() with fd_stop_both()

We used to require fd_remove() to remove an FD from a poller when we
still had the FD cache and it was not possible to directly act on the
pollers. Nowadays we don't need this anymore as the pollers will
automatically unregister disabled FDs. The fd_remove() hack is
particularly problematic because it additionally hides the FD from
the known FD list and could make one think it's closed.

It's used at two places:
  - with the async SSL engine
  - with the listeners (when unbinding from an fd for another process)

Let's just use fd_stop_both() instead, which will propagate down the
stack to do the right thing, without removing the FD from the array
of known ones.

Now when dumping FDs using "show fd" on a process which still knows some
of the other workers' FDs, the FD will properly be listed with a listener
state equal to "ZOM" for "zombie". This guarantees that the FD is still
known and will properly be passed using _getsocks().
src/listener.c
src/ssl_sock.c