Commit Graph

27 Commits

Author SHA1 Message Date
Andrew Bettison
c7a2fb4573 Add nibble-tree iterator
The new struct tree_iterator and associated start/get/next/free
functions replace the recursive walk() function, removing the need for a
callback when iterating over all nodes in the tree, and allowing
iteration to be suspended while other pseudo-threads are run.  This
allows an HTTP REST request to keep a tree_iterator in its state struct
and potentially simplifies other areas of the code.

The iterator free()s any empty internal tree nodes that it encounters,
as did the original tree_walk() function.  To support the existence of
multiple iterators at once, a reference count has been added to the
tree_node struct, to prevent any iterator from free()ing a node while
any other iterators point to it; only the last iterator to pop out of an
empty node will free() it.

The tree_walk() and tree_walk_prefix() functions have been
re-implemented to use an iterator state object internally.  This
resolves an outstanding TODO to perform tree-node freeing during a
prefix walk, and simplifies the code considerably.

Renamed some function parameters and struct members to make the
nibble-tree API a little more self-explanatory.

Added a nibble-tree test to the 'serval-tests' utility.
2018-03-29 15:19:54 +10:30
Andrew Bettison
093bdfdcd3 Add FALLTHROUGH macro to silence -Wimplicit-fallthrough in GCC7 2017-09-11 12:43:38 +09:30
Jeremy Lakeman
8ad03cb427 Don't fail to write a message ply, if the payload is already stored 2017-07-03 12:15:36 +09:30
Jeremy Lakeman
9cb561229a Allow following a feed that isn't in rhizome yet, and override the displayed name 2017-06-20 12:17:57 +09:30
Jeremy Lakeman
508e95436a Add API's for marking a feed as blocked 2017-06-07 13:52:44 +09:30
Jeremy Lakeman
9b7d8bfa23 Resume activity newsince when acking our own message 2017-05-10 15:21:21 +09:30
Jeremy Lakeman
3812587a31 Ack the senders ply and thread into activity feed 2017-05-10 11:01:02 +09:30
Jeremy Lakeman
f060e4dc59 Add Java api for meshmb restful activity 2017-04-19 14:46:37 +09:30
Jeremy Lakeman
4b98def664 Add newsince request for incoming activity 2017-04-19 14:46:37 +09:30
Jeremy Lakeman
bfbd2ddccd Abbreviate the bundle id in feed ack's 2017-04-19 14:46:37 +09:30
Jeremy Lakeman
1973df13b3 cli interface for reading threaded feed activity 2017-04-19 14:46:37 +09:30
Jeremy Lakeman
b7b77e81ee Add helpers for parsing ply records 2017-04-19 14:46:36 +09:30
Jeremy Lakeman
940b8c2d4b Ack incoming feeds for threading 2017-04-19 14:46:36 +09:30
Jeremy Lakeman
5ccff053c2 Add bundle author to feed metadata 2017-04-19 14:46:36 +09:30
Jeremy Lakeman
d2dfe71f26 Restful meshmb list subscribed feeds 2017-04-19 14:46:36 +09:30
Jeremy Lakeman
a8c29bbb15 Add MeshMB cli commands to follow and ignore feeds 2017-04-19 14:46:36 +09:30
Andrew Bettison
6d2eb268ed Add 'cmd_cleanup' trigger
The new 'cmd_cleanup' trigger replaces the old command_cleanup()
function, which was causing linking problems on OS X and inverted strict
dependency.  The keyring cmd_cleanup calls keyring_free(global_keyring),
instead of merely asserting keyring == NULL, so the error exit cases of
many CLI functions have been simplified.
2016-11-14 11:28:03 +10:30
Jeremy Lakeman
84caa24d0f Pass identity name as meshmb manifest name 2016-10-26 13:09:35 +10:30
Jeremy Lakeman
c2956568d6 Send a meshmb message via restful api 2016-10-26 13:08:13 +10:30
Jeremy Lakeman
5fbd6a79ef Add feature for meshmb cli to force linking into deamon 2016-10-20 09:28:08 -04:00
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
62a1ca46bc Wait for path establishment in network scan test 2016-09-27 15:51:23 +09:30
Jeremy Lakeman
b927af79a8 Introduce new typedef for signing keys to expose their internal structure 2016-09-27 10:28:46 +09:30
Jeremy Lakeman
f615a1deca Fix signed / unsigned warning 2016-09-21 09:33:08 +09:30
Jeremy Lakeman
67b9aeeb4e Add simple meshmb find command 2016-08-29 11:06:53 +09:30
Jeremy Lakeman
6a0b7a1da6 Allow for arbitrary extra manifest fields on broadcast messages 2016-08-24 16:33:39 +09:30
Jeremy Lakeman
b2eb3a2199 Begin broadcast messaging service 2016-08-16 15:04:15 +09:30