The quit-on-monitor-client-disconnect test was non-deterministic
depending on load (eg, other concurrently running tests). Under load,
it was likely that the server did not process the "monitor quit" command
before checking for disconnect, so the server did not terminate.
The fix was to make the monitor interface read and process all queued
input from the client before checking for HUP or ERR condition on the
socket. With this fix, the "sleep 1" kludges before and after the echo
"monitor quit" to the console command are no longer needed.
In the process the monitor interface code was modernised: eg, now it
calls read_nonblock() instead of read(2).
Ensure that timestamp always advances by at least one second every time
the config file is modified, add test case
Refactor test defs: detecting started HTTPD is not specific to Rhizome
Refactor struct file_meta and associated functions into "io.h" and io.c
Add various strbuf helper functions for formatting struct timespec
and struct file_meta to assist debug logging
The recent work on abstract local socket names means that every instance has
its own unique abstract socket name anyway, so there is no need for test
scripts to use $TFWUNIQUE in MDP and Monitor socket names to avoid
intereference when run concurrently.
Indepent configuration of show_pid, show_time and log level for each
destination
Update test scripts for new config options
Include xprintf.c in MDP client source files (now used by log.c)
The extract_stdout_keyvalue() function now accepts an optional delimiter
argument, to override its default of ':'. This makes it useful for extracting
the output of "servald config get" commands.
Fixes#21. The problem was caused when the double-fork logic used in "servald
start" was clobbered in 5103176. This meant that the servald daemon process on
Android no longer had a PPID=1, but the PID of the long-lived
"org.servalproject" parent process which called the JNI entry point. Killing
the servald process then caused it to become a zombie process, since the
org.servalproject does not habitually call wait(2). That caused the "servald
stop" logic to send five SIGHUPs to the zombie without any error, making it
appear that the process was not dying.
Reinstated the double-fork logic and added a new test case to ensure that the
daemon process does not become a zombie on being killed prematurely.