Commit Graph

96 Commits

Author SHA1 Message Date
Andrew Bettison
d8fd9fa411 Refactor nanosleep(2) calls into sleep_ms() function 2012-08-21 13:35:33 +09:30
Andrew Bettison
12d8bc0c12 Use new typedef time_ms_t everywhere 2012-08-09 12:14:32 +09:30
Andrew Bettison
240be25793 Replace overlay_gettime_ms() with gettime_ms() 2012-07-30 17:22:38 +09:30
Andrew Bettison
b9396505f8 Remove some unused declarations 2012-07-30 16:15:42 +09:30
Andrew Bettison
a69f637b3a Replace DEBUG_HLR with DEBUG_KEYRING
Convert several fprintf(stderr,...) into DEBUGF() statements
2012-07-27 11:26:19 +09:30
Andrew Bettison
a6a81a0f64 Improve server signal handling
Use sigaction(2) instead of deprecated signal(2), allowing SEGV et al to be
received in handler and therefore in re-spawned server.

Receive SIGSEGV et al in a separate handler function which kills the server
with the same signal if it does not re-spawn.

Log a GDB backtrace on SEGV et al before exiting or respawning.

Rename config option "serval.respawn_on_signal" to "server.respawn_on_crash".
2012-07-26 18:31:23 +09:30
Andrew Bettison
04b95d2590 Merge branch 'andrew' into 'master' 2012-07-25 18:04:16 +09:30
Andrew Bettison
c545061b50 Add server.respawn_on_signal config option 2012-07-25 17:02:57 +09:30
Andrew Bettison
6de247e576 Improve diagnosis of SEGV failures in tests 2012-07-24 15:39:36 +09:30
Andrew Bettison
3b44bb6e58 More progress on dnahelper 2012-07-19 17:59:45 +09:30
Jeremy Lakeman
27c24f377e Add deadline time for alarm prioritisation 2012-07-13 12:18:45 +09:30
Andrew Bettison
d2898ee22c Add output fields to 'keyring add' command 2012-07-06 13:17:53 +09:30
Andrew Bettison
78a8aaca16 Code improvements while debugging 'dnaprotocol' tests
Use ssize_t and size_t where required by system calls
More stringent checking of errors from system calls
Log the offset when writing to dummy interface file
Clean up many WHY/INFO/DEBUG statements
Convert many fprintf(stderr,...) to DEBUGF()
2012-07-03 15:36:51 +09:30
Andrew Bettison
8020ea3b74 Merge branch 'eventscheduler' into master
Conflicts:
	commandline.c
	monitor.c
	overlay.c
	overlay_interface.c
	overlay_packetformats.c
	rhizome_fetch.c
	rhizome_http.c
	rhizome_packetformats.c
	serval.h
	server.c
	testdefs.sh
	testframework.sh
	tests/dnaprotocol
	tests/server
2012-07-03 10:26:22 +09:30
Jeremy Lakeman
89566e4d3d Refactor how functions are scheduled or file handes are watched 2012-07-02 13:19:54 +09:30
Andrew Bettison
4516628c14 Replace fprintf(stderr,...) with DEBUGF 2012-07-02 12:52:21 +09:30
Andrew Bettison
a5ba1ecacd Clean up debugging code
Only use DEBUG inside "if (debug & DEBUG_BLAH)", not INFO or WARN or WHY!
INFO messages for starting/stopping servald server.
2012-06-28 15:37:36 +09:30
Jeremy Lakeman
29cba17891 Fix rhizome transfers 2012-06-27 16:54:42 +09:30
Andrew Bettison
4afdbe1b5e Add server start/stop tests 2012-06-26 15:52:37 +09:30
Andrew Bettison
5b56e2b131 Add server start/stop tests 2012-06-26 15:46:10 +09:30
Andrew Bettison
981afb795e Overhaul rhizome HTTP server start code 2012-06-26 11:07:01 +09:30
gardners
5dc6d122a5 significant progress towards clean callback scheduler for poll()
events and timed callbacks.
2012-06-22 16:05:49 +09:30
Andrew Bettison
0ec3feaa29 Expunge setReason()
Replace with WHY() or WHYF() everywhere

Improve logMessage() to handle file/line/function printing internally

Mainly so that log messages from manifest alloc/free in rhizome_bundle.c
can make it into the Android log
2012-05-24 17:11:55 +09:30
Daniel O'Connor
990a8f3057 Add support for srtuct ucred on BSD.
This requires building with _GNU_SOURCE to get access to struct ucred on Linux. Previously the test failed on every platform except glibc <2.8 or so.

Building with _GNU_SOURCE causes TRUE to be defined so we can't use this as a variable anymore, and MIN/MAX so don't define our own.
2012-05-21 12:22:50 +09:30
Andrew Bettison
f90b21ec78 Implement rhizome config options
rhizome.datastore_path - if not set, reverts to serval instance path
rhizome.enable - if not set, defaults to true
2012-05-15 12:56:10 +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
Andrew Bettison
d11258cefc Overhaul debug flags
Config debug flags are now represented as individual items, eg:
   servald config set debug.verbose yes
   servald config set debug.rhizome yes
instead of aggregated, eg:
   servald config set debug verbose,rhizome  <-- no longer works

Added a debug flag "debug.all" that can be set and cleared, over which
individual flag sets/clears take priority.

Slimmed down dna.c by moving some globals and functions to the files where they
are used.

Default command line (help message) is now the new style, not the deprecated
style.
2012-05-14 18:37:32 +09:30
Andrew Bettison
e746557a08 Fix bug in overlay_gettime_ms()
The sequence start time was only getting set in overlay_interface_init(), which
was not always called, or was called after overlay_gettime_ms() had already
been used.

Added FATALF(), FATAL() and FATAL_perror() macros.

Removed a bunch of debug statements no longer needed in monitor.c and server.c.
2012-05-11 10:38:46 +09:30
Andrew Bettison
881576212c Fix all trivial compiler warnings 2012-05-10 18:08:59 +09:30
Andrew Bettison
d96d8ff8d6 Move signal handling to server.c
Improve diagnostic messages from signal handler

For some reason, signal handler was not being set in server process when called
from main()
2012-05-09 19:06:44 +09:30
Andrew Bettison
836f8332e8 Replace perror() with WHY_perror()
Puts more diagnostics to Android log
2012-05-08 14:53:34 +09:30
Andrew Bettison
c6968c430a Minor bug fix in diagnostic output 2012-05-08 14:04:41 +09:30
Andrew Bettison
391e8d7056 Fix broken stopfile logic
'start' command removes stopfile just before starting
'stop' command removes stopfile after stopping
2012-05-08 12:53:59 +09:30
Andrew Bettison
329189ec8c Fix bodgy server start/stop logic
Rename pidfile 'serval.pid' to 'servald.pid'
Rename stopfile 'doshutdown' to 'servald.stop'
Reinstate checking of stopfile on signals and in main loops
Correct delay loops in 'start' and 'stop' commands
Move some code from commandline.c to server.c
2012-05-08 12:19:52 +09:30
Andrew Bettison
6376baf8b8 Follow-up fixes to serval.pid clobber termination 2012-05-08 11:27:07 +09:30
Andrew Bettison
acc5e48f4f Terminate server process if serval.pid clobbered 2012-05-08 11:23:43 +09:30
Andrew Bettison
09f8434a21 Improve "start" command
Add "start exec <exec path>" variants for background mode
Add background startup wait logic, so that pid can be reported to caller
2012-05-07 19:14:52 +09:30
Andrew Bettison
cbc367b1f5 Rewrite server start/status/stop commands
Now correctly probes for server process existence using kill(pid, 0)
Status command does not dump config (use "config get" instead)
Output uses JNI cli output fields
Stop command uses 5 Hz wakeup, not busy wait while server exits
2012-05-07 13:49:38 +09:30
gardners
14e4af6392 DNA replies now include name. "set did" now accepts name.
Keyring now stores name. "node info resolvedid" now returns name.
2012-05-01 14:38:09 +09:30
gardners
283b29af6b Improved packet tx and rx debugging and made it more logical. 2012-04-14 06:38:11 +09:30
gardners
faa2f5ef6c Fixed keyring opening sequence for overlay mode. 2012-04-14 02:38:09 +09:30
gardners
aa7da3e2c9 Fixed format of DIDs when sending DNA resolution replies from
new keyring format.
2012-04-13 10:27:38 +09:30
gardners
099e7ab118 Fixed searching for DIDs with wildcard with keyring.
General improvements to handling identities from keyrings.
Fixed placing of DONE flag for each identity that a query
produces results as.
Various other fixes.
2012-04-13 10:23:59 +09:30
gardners
3e920c8dfa simple server mode now correctly opens and populates keyring
with any identities with blank pins.
2012-04-13 09:35:22 +09:30
gardners
5ac83f9ca1 Replaced use of HLR with keyring for phone number lookups and
other functions.  Not yet tested.
2012-04-13 09:25:03 +09:30
Andrew Bettison
91d19df5cb Ressurect testdna script 2012-04-03 19:15:39 +09:30
Andrew Bettison
e87e80aee7 Create instance directory in "set" and "node start" 2012-03-29 15:03:17 +10:30
Andrew Bettison
a338c2f0f9 Refactor instance path handling
- handle buffer limits when forming path names within instance dir
 - uniform use of serval_instancepath()
2012-03-29 14:07:07 +10:30
Andrew Bettison
4e29cb1eb3 Fix some dodgy code and remove the #warning message pointing to it 2012-03-26 15:03:57 +10:30
gardners
4cc2890637 Added warning for handling of sid in a function that appears to violate
some previous assumptions in the code.  To be examined.
2012-03-17 09:28:49 +10:30