Commit Graph

63 Commits

Author SHA1 Message Date
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
f6c899e107 Refactor overlay buffer interface to support simple parsing 2012-08-31 15:03:07 +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
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
Jeremy Lakeman
152d46ddb6 Reduce and improve logging 2012-08-09 13:30:52 +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
Jeremy Lakeman
ddba8033e4 Refactor packet envelope and sid abbreviation reading and writing 2012-07-17 15:30:50 +09:30
Jeremy Lakeman
e9566de0af Fix payload length fields 2012-07-13 12:18:49 +09:30
Andrew Bettison
41f3228300 Refactor rhizome HTTP request parsing
Replace DEBUG_RHIZOMESYNC with DEBUG_RHIZOME_TX
2012-07-13 11:06:10 +09:30
Andrew Bettison
d111f763c7 Fix bugs revealed by 'rhizomeprotocol' test
Was not transmitting actual HTTP server port in rhizome announcements, was
always transmitting port 4110.

When trying for a free HTTP server port, sometimes bind() succeeds but listen()
fails with EADDRINUSE, so new logic to deal with that.
2012-07-12 12:10:59 +09:30
Andrew Bettison
4eb3910dc1 Fix bug in Rhizome fetch - byte order of sin_port
Also improve some debug logging
2012-07-11 14:21:49 +09:30
Andrew Bettison
72769e162b Replace overlay_render_sid_prefix() with alloca_tohex()
To eliminate timebomb bugs caused by rotor wraparound
2012-07-04 10:30:46 +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
Andrew Bettison
d689e96454 Fix rhizome HTTP port number in packet 2012-07-02 16:07:35 +09:30
gardners
aab400164f push manifest verification to as late as possible to avoid
unwarranted 400ms CPU hits for every manifest seen.
2012-06-26 16:54:40 +09:30
gardners
e542b41746 instrumented various rhizome functions. 2012-06-26 16:03:34 +09:30
Andrew Bettison
3d0038754b Add HTTP port number to rhizome advertise packet 2012-06-25 18:03:00 +09:30
Andrew Bettison
86c7819f97 Remove spurious ERROR messsages
Tests assert that stderr contains no ERROR: lines after a successful exit

Rewrote sqlite_exec_int64() to separate error outcomes from legitimate
result values

Changed several WHY() calls to DEBUG()

Improved test framework
2012-06-08 13:13:26 +09:30
gardners
0cccb5bf83 debug cleanup 2012-05-28 13:51:23 +02:00
gardners
40ed766880 debugging fiddles. 2012-05-27 08:52:36 +02:00
gardners
30e53f963c fixed various manifest synchronisation bugs, including probably
the main one that was stopping meshms (large manifests would
practically never get advertised under certain (common) conditions).
2012-05-27 08:31:48 +02:00
gardners
04cc05d6e1 refactored manifest verification into a separate function
that is called only when needed, and marks a manifest as finalised
if the verifcation fails.  reading a manifest now never sets
finalised flag, as either _finalise() or _verify() must be called.
2012-05-26 11:36:18 +02:00
Andrew Bettison
d215d90b40 Refactored some rhizome db SQL code
Added sqlite_exec_void() function, so that sqlite_exec_int64() can return
an error if no rows are found instead of 0, which can be misleading.
2012-05-25 19:42:45 +09:30
Andrew Bettison
fdb34593ed Improve Rhizome saw-advertisement debug logging 2012-05-25 18:07:19 +09:30
Andrew Bettison
bea9188cd5 Fix another manifest leak
Add manifest alloc/free debug logging to help, 'debug.manifests' option
2012-05-25 17:01:56 +09:30
Andrew Bettison
49aec4d331 Improve rhizome manifest debugging
Move rhizome_new_manifest() out of rhizome_read_manifest_file() so that the
out-of-manifest report shows the names of the functions where the manifests
were really allocated.
2012-05-25 15:38:13 +09:30
Andrew Bettison
e74b9e1d6b Maybe fix cause of SEGV bug
Was caused when we ran out of manifest structs
2012-05-24 17:27:59 +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
Andrew Bettison
60e4209b88 Diagnose and fix rhizome MeshMS 2012-05-23 19:01:07 +09:30
gardners
115cb942dc included fix for suppressing bad behaviour due to signature-less manifests. 2012-05-22 17:33:33 +09:30
gardners
a9be08b0cc supress bad rhizome manifest messages. 2012-05-22 17:24:06 +09:30
gardners
6a83f2434f cleaned up some debug output, among other things. 2012-05-22 17:04:24 +09:30
gardners
e319b146a6 cleaned up some debugging. 2012-05-22 15:57:19 +09:30
gardners
e3387fbecf periodic sucking in from rhizome prioritised list now works. 2012-05-22 15:57:18 +09:30
gardners
f528110257 almost have priority pre-listing of bundles for rhizome working. 2012-05-22 15:57:18 +09:30
gardners
0abc7ff96e added code to create and maintain priority download list for
rhizome, so that we get things in a sensible order.
2012-05-22 15:57:18 +09:30
gardners
3866352340 further improvements to supressing broken manifest time wasting
in rhizome.
2012-05-22 14:20:01 +09:30
gardners
8e9396419c adding ignored manifest list to let us ignore repeated offerings
of broken manifests without wasting effort.
2012-05-22 14:15:35 +09:30
gardners
29bb86d9e7 first cut at supressing rhizome activity during calls. 2012-05-22 13:05:29 +09:30
gardners
4a3fc65385 back out undefined function bug. 2012-05-22 12:11:42 +09:30
gardners
fd343ca5b0 debug fiddles etc. 2012-05-22 11:45:54 +09:30
gardners
c3350bb493 fix bug introduced in using snprintf instead of strbuf_*
use WHY() macros for all output.
2012-05-22 10:02:24 +09:30
gardners
f562a6361d completed working around strbuf_* bugs so that rhizome works again. 2012-05-21 22:45:08 +09:30
gardners
1349c045b2 fixed a null pointer dereference. 2012-05-21 14:09:53 +09:30
gardners
76663d1b9e fixed sqlite handle leaks when advertising rhizome manifests. 2012-05-17 11:14:10 +09:30
gardners
a811dbcab8 fixed some (but not all) rhizome database handle leak bugs in
rhizome advertisement code.
2012-05-17 11:14:10 +09:30
gardners
1b9f706209 fixed bug in dispatch of rhizome advertisements.
hopefully no more mal-formed packets.
2012-05-01 05:25:10 +09:30
gardners
5cc3283646 Cleaned up some debug output. 2012-03-27 19:50:31 +10:30
gardners
6759a26720 Cleaned out some debugging output after tracking down and fixing
memory corruption bug.  Next challenge is to find out why broadcast
MDP packets are not getting dispatched properly (is trying to treat
broadcast address as unicast address it seems).
2012-03-23 07:06:57 +10:30