]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: mworker: leave when the master die
authorWilliam Lallemand <wlallemand@haproxy.com>
Tue, 6 Nov 2018 16:37:16 +0000 (17:37 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 6 Nov 2018 17:30:57 +0000 (18:30 +0100)
commit7216032e6f5620f2abb15cb2695b5e78e868607d
treeee7c69b5de1234837b8dfb61096b8dd9666e4c5f
parent5d05db8ce1af46337a30ea5e399897fe459b36c6
MEDIUM: mworker: leave when the master die

When the master die, the worker should exit too, this is achieved by
checking if the FD of the socketpair/pipe was closed between the master
and the worker.

In the former architecture of the master-worker, there was only a pipe
between the master and the workers, and it was easy to check an EOF on
the pipe FD to exit() the worker.

With the new architecture, we use a socketpair by process, and this
socketpair is also used to accept new connections with the
listener_accept() callback.

This accept callback can't handle the EOF and the exit of the process,
because it's very specific to the master worker. This is why we
transformed the mworker_pipe_handler() function in a wrapper which check
if there is an EOF and exit the process, and if not call
listener_accept() to achieve the accept.
src/haproxy.c