Commit Graph

18 Commits

Author SHA1 Message Date
Andrew Bettison
c8bf8a7733 Refactor JNI out of CLI and server main loop
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.
2016-10-13 16:23:18 +10:30
Jeremy Lakeman
bd47a8eb60 Use libsodium for retrieving random bytes 2016-05-09 10:32:04 +09:30
Andrew Bettison
21f51965c1 Overhaul Makefile and header files
Make .o files in separate subdirectories for servald and library
Factor struct __sourceloc and __WHENCE__ from "log.h" into "whence.h"
Factor sid_t etc from "serval.h" into "serval_types.h"
Factor rhizome_bid_t etc from "rhizome.h" into "rhizome_types.h"
Do not include "serval.h" in library sources
Add log_stderr.c and logMessage.c for stand-alone executables
2014-05-26 15:36:26 +09:30
Jeremy Lakeman
7420f46653 Create new AF_UNIX based network simulator 2014-05-23 10:47:22 +09:30
Jeremy Lakeman
ca9faeef9b Remove respawn_on_crash behaviour, we aren't using or testing it 2014-05-12 13:44:51 +09:30
Andrew Bettison
2c0efc6334 Set up SEGV crash handler in main() not server()
Now all commands will attempt to log a GDB backtrace on a crash, not
just the server daemon process.

Added strbuf_append_signal_name()
2014-05-08 14:24:00 +09:30
Andrew Bettison
9b64bb87e0 Uniform copyright notices
Added some missing copyright/license block comments
2013-12-04 17:15:36 +10:30
Jeremy Lakeman
53f3920b90 Move cli global state into a structure and pass it around 2013-07-03 16:51:27 +09:30
Andrew Bettison
caa209fc1d Integrate new config into servald
Not passing any tests yet, but compiles and links and simple uses do not
SEGV.
2012-12-04 14:12:28 +10:30
Jeremy Lakeman
f93216f369 Remove dead code 2012-10-19 15:02:22 +10:30
gardners
93449d380e various fixes for libmonitorclient and commits made by others
inbetween. Hopefully I have captured all the changes.
2012-07-29 12:35:53 +09:30
Andrew Bettison
0dee99dec2 Remove old command-line support 2012-07-27 11:44:20 +09:30
Andrew Bettison
6de247e576 Improve diagnosis of SEGV failures in tests 2012-07-24 15:39:36 +09:30
Daniel O'Connor
930280a17d Move signal handler setup to main so it's only done once. 2012-06-25 16:24:33 +09:30
Andrew Bettison
55405fb081 Fix old command line bug in main()
Was calling new command-line parser when first option starts with '-'
2012-05-20 13:45:12 +09:30
Andrew Bettison
9b18a2fee4 Fix compile error: change #ifdef 0 to #if 0 2012-05-17 17:01:02 +09:30
gardners
1171e60704 added backtrace function, which sadly doesn't work on android. 2012-05-17 16:36:23 +09:30
Andrew Bettison
7087afc404 Refactor main() into main.c
Now dna.c only contains code for the old command line
2012-05-15 11:09:21 +09:30