The CLI and server main loop now have no conditional JNI code. All JNI
code has been moved into separate source files, which #include the new
"jni_common.h" instead of <jni.h>. The "cli.h" header no longer
includes <jni.h>, so the rest of the Serval source code is now
unaffected by JNI definitions.
The 'cf_limbo' global variable is now thread-local, so that each thread
has its own independent copy of the loaded configuration. The JNI
server entry point now calls cf_init() once. The new 'cf_initialised'
flag prevents clobbering the config state by redundant calls to
cf_init().
The CLI "stop" command now sends SIGHUP to the specific thread in which
the server is running. This is achieved by writing the PID and TID
(Linux Thread ID) into the pidfile, separated by a space, on systems
that support the Linux gettid() and tgkill() system calls. The server's
signal handler has been overhauled, and its logging improved.
The execute() and executeOk() functions now set $TFWEXECUTED instead
of $executed.
The execute() and executeOk() functions now make a hard link from the
--stdout-file=PATH and --stderr-file=PATH files to the default files
of 'stdout' and 'stderr' so that post-fork handling can still cat their
contents into the log file.
The fork() function now sets the variables $TFWFORKSTDOUT_<label>
$TFWFORKSTDERR_<label> $TFWFORKPID_<label>.
Ignores a variety of warnings when compiling sqlite3.c.
Uses the new sqlite3_trace_v2() function for logging SQL statements, now
that sqlite3_trace() and sqlite3_profile() are deprecated.
Fixes a rhizomeops test failure caused because SQLite 3.12 increased the
default block size from 1024 to 4096, causing the fixed overhead of an
empty Rhizome db to exceed 32KB. This caused the test to fail because
the first "file add" failed. Now the test fixture adapts to the fixed
overhead.
Deletes the SQLite 3.10.2 source amalgamation.
The recent randomising of keyring slots broke an assumption
about the order of the 'keyring list' output. Now the test's
assertions do not assume any order.
The in-memory identity creation test was failing intermittently because
the server only creates the in-memory identity on the first tick, and
under load the server sometimes does not tick for a while, leading to a
race with the "servald id self" command.
The test case now waits for the server to emit a tick before running the
"id self" command. This necessitated a new DEBUG() statement and a new
debug flag 'overlaytick'.
Also disabled Rhizome for all the keyring tests, as unnecessary Rhizome
DB creation was slowing down the fixtures.
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).
On OS-X (BSD), nc6 appears to be the only available variant of
netcat that matches the Linux version.
Introduces a guard function to catch invocations of nc6 when
setup_netcat6 has not been called in the fixture. Introduce
guard functions to prevent invocations of nc and netcat.
Use GNU grep, sed and awk instead of BSD variants. Developers will have
to install these using a package manager like homebrew. Updated the
INSTALL.md and doc/Development.md tech docs with instructions.