Commit Graph

1349 Commits

Author SHA1 Message Date
Jeremy Lakeman
3b55643b08 Send my full sid periodically for any outgoing payload header 2012-09-07 10:01:34 +09:30
Jeremy Lakeman
9e86bb476e Allow for parsing an expected broadcast address 2012-09-06 16:44:05 +09:30
Jeremy Lakeman
472a7cea20 Always send a full sid when we hear an unknown / new sid 2012-09-06 16:38:11 +09:30
Jeremy Lakeman
f9287149dd Setup unicast return address when receiving unicast packet 2012-09-06 15:21:31 +09:30
Jeremy Lakeman
adde23dfd0 Fix for restarting interfaces with different broadcast address 2012-09-06 09:57:36 +09:30
Jeremy Lakeman
0588835009 Set defaults, more logging 2012-09-06 09:35:33 +09:30
Jeremy Lakeman
c6eafb5380 Demote port comparison from an assert to an error 2012-09-01 12:41:51 +09:30
Jeremy Lakeman
545c05fddb Relay broadcast payloads via olsr plugin 2012-09-01 12:41:50 +09:30
Jeremy Lakeman
cf22ef8e8c Ensure route and interface is still valid before sending packet 2012-09-01 12:41:50 +09:30
Jeremy Lakeman
211e25608e Send packet to unicast address 2012-09-01 12:18:39 +09:30
Jeremy Lakeman
1b91724da2 Allow for interfaces that don't tick, pack rhizome manifests into all packets 2012-09-01 12:18:39 +09:30
Jeremy Lakeman
1f6607af14 Refactor to avoid returning a pointer to the stack 2012-09-01 12:17:22 +09:30
Jeremy Lakeman
e05806f25e Separate routing calculation from resulting rules, refactor more code to use subscriber structure 2012-08-31 15:11:18 +09:30
Jeremy Lakeman
df0e20408c Close sockets on poll errors 2012-08-31 15:04:06 +09:30
Jeremy Lakeman
f6c899e107 Refactor overlay buffer interface to support simple parsing 2012-08-31 15:03:07 +09:30
Jeremy Lakeman
22c6b530ed Rework broadcast address handling, working towards a unified address struct 2012-08-31 15:03:07 +09:30
Jeremy Lakeman
aa5706f9d7 Refactor routing node information to use new subscriber tree 2012-08-31 15:03:07 +09:30
Jeremy Lakeman
30d5ed2b6d Simple refactoring 2012-08-31 15:03:07 +09:30
Jeremy Lakeman
90cbf8df7e Add new subscriber storage 2012-08-31 15:03:06 +09:30
Daniel O'Connor
e7201963d0 Staticise a bunch of functions so I get some understanding of what is needed where. 2012-08-31 12:13:20 +09:30
Andrew Bettison
9149c80297 Improve test framework: assert '!' command...
The assert command now supports leading '!' args in its command, each negating
the sense of the following command.
2012-08-30 09:33:15 +09:30
gardners
bae2e2e4c2 Updated non-Android build process to work again (sqlite3 include path fixed,
also improved so that sqlite3.c doesn't need to exist as a symlink to the
real file).
2012-08-27 17:03:50 +09:30
Andrew Bettison
00c9c540f5 DNA helper treat poll(2) POLLNVAL like POLLERR
Fixes #5, test cases failing on Mac OS X
2012-08-27 13:03:13 +09:30
Andrew Bettison
60d84817bf Add WARNF_perror() macro 2012-08-27 13:03:13 +09:30
Daniel O'Connor
19dd10b1cc Log the address & port of the sender of a broken Rhizome packet. 2012-08-27 12:11:06 +09:30
Daniel O'Connor
00b350aeb1 Add a note about why we aren't using SIPS/ZRTP. 2012-08-27 11:28:06 +09:30
Andrew Bettison
30e21810e4 Improve dnahelper diagnostics to investigate issue #5 2012-08-27 11:19:59 +09:30
Andrew Bettison
836a6d9b6a Issue #5, fix one failing test, two to go
On Max OS X, /bin/sh does not support echo -n option, but /bin/bash does
2012-08-24 18:40:30 +09:30
Andrew Bettison
25fbd6ffe0 Improve test framework: colours on Max OS X
Fixes #7.
2012-08-24 16:30:41 +09:30
Andrew Bettison
3a6b424c2d Fix test framework: job tracking on Mac OS X
Caused by difference in basic regular expressions supported by sed(1) on Mac
and on Linux: Mac does not support the \+ repeater, have to use \{1,\} instead.
2012-08-24 16:02:21 +09:30
Andrew Bettison
3f1e0dd763 Finish sleep-retry on locked Rhizome db
Closes #2.

Rewrite all Rhizome db query code using new retry primitives defined in
"rhizome.h": sqlite_step_retry(), sqlite_retry(), sqlite_retry_done(), etc.
Replace all calls to sqlite3_prepare_v2() with sqlite_prepare() which does
proper error logging.

Fix bug: re-invoking sqlite3_blob_close() on SQLITE_BUSY return causes process
to abort.  Use an explicit BEGIN...COMMIT around the blob writing code instead.

Tested using repeated invocations of batphone/tests/meshms1.

Delete deprecated Rhizome db code in rhizome_crypto.c that has been replaced
with keyring file.
2012-08-24 15:38:39 +09:30
Daniel O'Connor
d793dbc948 Restore testframework.sh that I previously rewound. 2012-08-24 15:36:17 +09:30
Daniel O'Connor
0dd2145ed4 assert that the port number matches between calls to overlay_interface_init_any() 2012-08-24 15:21:23 +09:30
Daniel O'Connor
e98ec36391 Set MYSID to my SID before starting the dna helper so it can return it in a SID URI. 2012-08-24 11:43:30 +09:30
Andrew Bettison
bb4819aa83 Issue #2, sleep-retry logic in all Rhizome operations
Much refactoring and removal of cruft.

SQL query errors are now logged with the filename, line number and function
where they were invoked, not of the low-level function that discovered the
error.  This makes use of the new __HERE__ notation introduced last commit.
2012-08-23 17:43:35 +09:30
Andrew Bettison
27a0a6eeb5 Introduce struct __sourceloc
Replaces (const char *file, unsigned int line, const char *function) arguments
to all logging functions, simplifies malloc/free tracking code in
overlay_buffer.c and Rhizome manifest alloc/free tracking in rhizome_bundle.c.

Use __HERE__ macro instead of (__FILE__, __LINE__, __FUNCTION__) everywhere.

Special __NOWHERE__ macro is equivalent to (NULL, 0, NULL).

Declare net.c functions in new "net.h" header, so log.c doesn't have to pull
in the entire "serval.h" just to use write_str().

Facilitates progress on issue #2.
2012-08-23 12:31:07 +09:30
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