Commit Graph

1363 Commits

Author SHA1 Message Date
Andrew Bettison
fd3da58a7c Issue #2, add sleep-retry logic for most database queries
All the queries that used sqlite_exec_void() and sqlite_exec_int64() and
sqlite_exec_strbuf() now do a sleep-retry while the Rhizome db is locked.

There are other queries that still need conversion, and some old infinite
retry logic that needs replacing.
2012-08-22 19:09:30 +09:30
Andrew Bettison
65d6bf191a Fix strbuf API comment 2012-08-22 19:03:00 +09:30
Andrew Bettison
d8fd9fa411 Refactor nanosleep(2) calls into sleep_ms() function 2012-08-21 13:35:33 +09:30
Andrew Bettison
83cb027484 Add FATALF_perror() macro 2012-08-21 13:35:33 +09:30
Andrew Bettison
e534d93a84 Fix tests broken by execpath change
Commit 5cbc2167ec changed the servald 'start'
command to use a different argv[0], which meant that the testdefs.sh
get_servald_pids() function no longer detected running servald processes.
This broke most of the 'server' test cases.

testdefs.sh setup_servald() now makes a full copy of servald once per test
case, not just a symbolic link, so that the logic in get_servald_pids() works
again.
2012-08-21 13:35:33 +09:30
Jeremy Lakeman
48c899df39 Pass remote sequence number through monitor interface 2012-08-21 13:32:55 +09:30
Jeremy Lakeman
00b1609deb Fix audio rotor buffer 2012-08-21 13:32:55 +09:30
Jeremy Lakeman
890feaadc9 Fix snprintf arguments 2012-08-21 13:32:55 +09:30
Andrew Bettison
5cbc2167ec Start on problem of database lock errors
Add sqlite_exec_void_retry() function, use it in
rhizome_update_file_priority().  This should be reviewed to ensure that the
server process never sleeps.

The general problem remains of what the servald process should do if the
database is locked when it tries to update.  Simplest solution is to sleep and
retry, but that blocks all other services and would hurt VoMP.  A better
solution would be for each Rhizome operation to collect its database updates
into a single transaction and place that in a work queue that gets called using
schedule() (or even watch() if a file-descriptor event can somehow be used when
the database becomes available).  Another solution is perhaps to perform all
Rhizome operations in a dedicated process that can block indefinitely on the
database without affecting servald responsiveness.
2012-08-20 18:43:48 +09:30
Andrew Bettison
1c1e1a8ad0 Add WHYFNULL() macro 2012-08-20 18:43:48 +09:30
Andrew Bettison
3d82983888 Improve test framework: better log messages from assertGrep 2012-08-20 18:43:47 +09:30
Jeremy Lakeman
b9874af3b9 Really fix initialisation of monitor client 2012-08-20 16:11:33 +09:30
Daniel O'Connor
fc20a4768d Use get_self_executable_path to resolve our name when calling
exec otherwise it will fail when given a relative path as we
chdir to / before trying it.
2012-08-20 15:02:00 +09:30
Andrew Bettison
a14c8427cb Improve test framework: kill residual processes 2012-08-20 11:28:03 +09:30
Andrew Bettison
385e2bdb4e Improve Rhizome INFO messages 2012-08-17 19:42:11 +09:30
Andrew Bettison
d678680d40 Improve test framework: assertExpr '~' operator
The '~' (regular expression match) operator does not implicitly anchor the
expression to the ends of the text, ie, does not put ^...$ around the pattern.
That leaves the test writer free to specify a full or anchored or interior
match.
2012-08-17 17:56:42 +09:30
Andrew Bettison
9310a15cbd Improve test framework: better output from tfw_cat 2012-08-16 16:58:41 +09:30
Jeremy Lakeman
1a468f23b6 Fix off by one bug in payload length storage 2012-08-16 16:25:20 +09:30
Jeremy Lakeman
7b224d8947 Fix initialisation of monitor client 2012-08-16 15:39:11 +09:30
Andrew Bettison
3c736b1f6c Improve test framework: orderly shutdown on signal
Uses bash job control internally instead of PIDs, because job control
allows all processes in a job to be killed.

Changes the way _tfw_shopt/_tfw_shopt_restore work, to avoid "unrestored shopt"
errors on interrupt.
2012-08-16 12:17:15 +09:30
Andrew Bettison
e1fb64e9d4 Improve test framework: assertExpr
Change internal implementation of assertExpr to use shell commands test(1) and
grep(1) instead of awk(1), so that we can write 'assertExpr "$var" '~' "$rexp"
where $rexp is a grep regular expression.  (awk(1) does not support \{N,M\} in
regular expressions.)
2012-08-15 18:46:57 +09:30
Jeremy Lakeman
60a82eb251 Improve logging 2012-08-14 16:31:29 +09:30
Jeremy Lakeman
58457a703d Refactor monitor port bindings 2012-08-14 14:37:16 +09:30
Jeremy Lakeman
e302238b29 Trigger a sas key lookup when peers are reachable 2012-08-14 14:37:16 +09:30
Jeremy Lakeman
51de755be2 Avoid unnecessary warning during neighbour discovery 2012-08-14 14:37:16 +09:30
Jeremy Lakeman
dd78c11db0 Clear monitor state structure 2012-08-14 14:37:16 +09:30
Andrew Bettison
eec8fb6e95 Improve SAS resolution debug messages 2012-08-14 14:06:59 +09:30
Andrew Bettison
cd35c5e2ae Fix issues arising from new strlcpy.c 2012-08-14 11:23:27 +09:30
Daniel O'Connor
d77e5b7c62 Add strlcpy as it appears some systems (Ubuntu and probably Debian) don't have it.
This is a public domain version from http://cantrip.org/strlcpy.c
2012-08-13 18:24:19 +09:30
Jeremy Lakeman
dcb2da45fa Allow for audio to arrive in variable sized blocks 2012-08-13 16:35:30 +09:30
Jeremy Lakeman
e69a492c2b Fix socket leak 2012-08-13 14:02:13 +09:30
Jeremy Lakeman
3ab79d8e5b Pass phone numbers in vomp call initiation 2012-08-13 14:01:57 +09:30
Jeremy Lakeman
2bd26dfcdb Send monitor dna response with my sid in uri 2012-08-12 16:03:18 +09:30
Daniel O'Connor
f453071251 Fix compilation in the non-JNI case 2012-08-10 16:55:38 +09:30
Jeremy Lakeman
6981e7e2c2 Allow monitor clients to resolve did's 2012-08-10 15:29:19 +09:30
Jeremy Lakeman
f77e055988 Add timeout argument for dna lookup 2012-08-10 15:29:19 +09:30
Daniel O'Connor
75889355fa Build static library version of libmonitorclient. 2012-08-10 14:36:46 +09:30
Daniel O'Connor
15013d7086 Fix bug in debug printing. 2012-08-10 10:45:01 +09:30
Andrew Bettison
39325e0262 Fix compile error 2012-08-09 13:45:57 +09:30
Jeremy Lakeman
6f9cf490dc Standardise session id format 2012-08-09 13:32:09 +09:30
Jeremy Lakeman
fb6090917a Tweak call failure timeouts 2012-08-09 13:32:08 +09:30
Jeremy Lakeman
fd111a4d1f Listen to INADDR_ANY on OSX, otherwise we can't hear broadcasts 2012-08-09 13:32:08 +09:30
Jeremy Lakeman
f059546eb0 Improve monitor client interface and vomp for asterisk channel driver 2012-08-09 13:32:08 +09:30
Jeremy Lakeman
736a8f43c0 Refactor towards changing the vomp monitor interface 2012-08-09 13:32:08 +09:30
Jeremy Lakeman
7705676a9e Move str functions to c file to enable reuse 2012-08-09 13:30:52 +09:30
Jeremy Lakeman
fc9a9b337e Wait for vomp client to indicate that ringing has started 2012-08-09 13:30:52 +09:30
Jeremy Lakeman
152d46ddb6 Reduce and improve logging 2012-08-09 13:30:52 +09:30
Jeremy Lakeman
409186eced Don't bother to calculate scores for invalid nodes 2012-08-09 13:30:26 +09:30
Andrew Bettison
ec4384ae7d Fix failing 'dnahelper' test case 2012-08-09 12:21:40 +09:30
Andrew Bettison
12d8bc0c12 Use new typedef time_ms_t everywhere 2012-08-09 12:14:32 +09:30