]> git.tuebingen.mpg.de Git - paraslash.git/commit
server: Shutdown the scheduler before handling commands.
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 7 Aug 2017 01:44:07 +0000 (03:44 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Tue, 13 Mar 2018 02:28:10 +0000 (03:28 +0100)
commit17c140cc24838c2b7049e2b4c17621f4284d53dc
tree278d1104fb5f4e172890bae1783ecefabeefa382
parent0b786d977ded3c3922e851e5b8d60837b43469b9
server: Shutdown the scheduler before handling commands.

Currently the command handlers are called from the ->post_select
method of the command task after the main server process has forked.
When the command handler is done, it exits with the scheduler still
active. This is not a problem per se, and it has been like this
for more than a decade, but it does make it harder to debug memory
leaks because we leak some resources. Valgrind complains about this,
cluttering the output with pointless warnings.

This commit cleans up the memory handling of the child process on
exit. The command task of the child process notifies all tasks in its
->post_select method and then returns the new pseudo error code
-E_CHILD_CONTEXT. This causes the scheduler to return to main().

The main() function checks via the new ->child_fd of struct
server_command_task whether it is running in child context after
schedule() has returned and calls the command handler in this case.
command.c
error.h
server.c
server.h
vss.c