Commit Graph

1166 Commits

Author SHA1 Message Date
Andrew Bettison
6bb0d93d85 Add strbuf_tohex() primitive 2012-07-20 18:17:04 +09:30
Andrew Bettison
3b44bb6e58 More progress on dnahelper 2012-07-19 17:59:45 +09:30
Andrew Bettison
5aac5a3854 Unfinished dnahelper implementation 2012-07-18 19:16:30 +09:30
Andrew Bettison
117a3191ab Fix test framework: shorter tmp dir name
So that socket names do not exceed system limit
Also add some comments explaining a few obscure points
2012-07-18 16:29:56 +09:30
Andrew Bettison
c8a538337d Improve test framework: do not use $BASHPID
Also do not allow -j and --verbose to be given together
2012-07-18 14:44:28 +09:30
Andrew Bettison
3c09a1ec7d Fix broken log WARN messages in "rhizome list" 2012-07-17 18:07:02 +09:30
Andrew Bettison
bc11b16d96 Remove spurious DEBUG() statement 2012-07-17 15:33:04 +09:30
Andrew Bettison
c31d360b7a Improve 'rhizomeprotocol' tests
New test case for big payload (1 MB + 2 bytes)
Check that received payloads are identical to sent ones
Refactored test code
2012-07-17 14:09:35 +09:30
Andrew Bettison
b50943d09c Fix handling of empty payload (filesize = 0)
Do not add 'filehash' var to manifest if filesize=0
Do not accept 'filehash' var when parsing manifest with filesize=0
When responding to a new rhizome advertisement, do not try to HTTP
request a payload if filesize=0, just import the manifest directly
Various operations, eg "rhizome file add", do not report 'filehash'
fields where 'filesize' is zero
Do not delete rows from MANIFESTS table which have empty filehash
Various related bug fixes
2012-07-16 18:40:30 +09:30
Andrew Bettison
9d69a3c2bd Add new 'rhizomeprotocol' test case
Replacing a bundle with an empty payload, "unsharing" in UI terms
2012-07-16 18:40:30 +09:30
Andrew Bettison
d59378961c Improve rhizome test defs
Handle manifests with empty payloads:
 - assert_manifest_complete() asserts for a filehash field if the
   filesize is non zero, otherwise asserts for NO filehash field
 - assert_stdout_add_file() ditto
 - unpack_manifest_for_grep() allows an empty name if payload also empty

create_rhizome_identities() sets SID and SID{I} vars

assert_rhizome_list() dumps stderr if any assert fails
2012-07-16 18:40:30 +09:30
Andrew Bettison
61bfb7bbbc Improve 'rhizomeops' test for empty payload 2012-07-16 18:40:30 +09:30
Andrew Bettison
801a0fb7b0 Improve test framework: --filter by test numbers 2012-07-16 18:40:30 +09:30
Andrew Bettison
e67d09cf11 Fix bug in test framework output 2012-07-16 18:40:30 +09:30
gardners
636574d1cf towards DNA helper application. 2012-07-16 17:05:13 +09:30
gardners
5824c38a28 added simple random input tester for packet visualisation.
Need to supplement it with a better fuzz tester.
2012-07-16 16:28:07 +09:30
gardners
7c5c6b0826 work towards DNA helper interface. 2012-07-16 13:00:55 +09:30
gardners
71eb3de446 minor work towards DNA helper working. 2012-07-16 12:47:04 +09:30
gardners
47dbb8cee5 fixed bug when fork()ing to start DNA helper.
added some debugging.
2012-07-16 12:47:04 +09:30
Andrew Bettison
c791ba94d0 Refactor HTTP response parsing
Remove need to nul-terminate the received buffers in HTTP fetch reply handling
and HTTP server request parsing.

Remove redundant copying of data.

More rigorous parsing code, probably less vulnerable to overrun exploits.

Better debug logging of requests and responses.
2012-07-13 18:06:55 +09:30
Andrew Bettison
0c260a966e Small improvement in toprint() 2012-07-13 18:00:25 +09:30
Jeremy Lakeman
c09582a220 Transfer should work for small files that arrive with the headers 2012-07-13 13:44:05 +09:30
Andrew Bettison
1fe59edcc6 Control logging from fdqueue.c with DEBUG_IO 2012-07-13 12:51:27 +09:30
Andrew Bettison
dd225bbb7f Refactor rhizome HTTP response headers 2012-07-13 12:31:10 +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
dcf7209304 Add read_nonblock() function
Deal with platforms where EWOULDBLOCK != EAGAIN
2012-07-13 11:04:50 +09:30
Andrew Bettison
e378a8dc82 Improve logging from rhizome HTTP server 2012-07-12 16:42:41 +09:30
Andrew Bettison
49ee4d13f0 Re-write manifest parsing, improve rhizome_fetch.c logging
Rhizome manifest parser now parses and validates all known fields, informs
about unsupported fields, and unpacks fields into relevant struct manifest
elements where appropriate.  Is also stricter about whitespace.

Rhizome fetch code now logs debug messages if DEBUG_RHIZOME_RX bit is on.
2012-07-12 16:39:01 +09:30
Andrew Bettison
025ccad810 Replace DEBUG_DNAVARS with DEBUG_RHIZOME_RX
Delete some obsolete HLR code
Mark DEBUG_HLR as deprecated
2012-07-12 16:26:37 +09:30
Andrew Bettison
208a95a233 Replace validateSid() with str_is_subscriber_id() 2012-07-12 16:14:25 +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
e69abc3198 Add 'rhizomeprotocol' multi-transfer test 2012-07-11 17:42:30 +09:30
Andrew Bettison
bdd0bb357f Improve logging config options
Rename config option "logfile" to "log.file"
Add "log.show_pid" boolean
Add "log.show_time" boolean
2012-07-11 17:09:50 +09:30
Andrew Bettison
f50da147d6 Fix log.c: open_logging() sets log_pid and log_time vars 2012-07-11 16:59:08 +09:30
Andrew Bettison
ff2c98afb3 Add "rhizome.fetch_interval_ms" config option 2012-07-11 16:51:30 +09:30
Andrew Bettison
218e7883ce Improve test scripts: use new 'wait_until' primitive 2012-07-11 16:51:29 +09:30
Andrew Bettison
cc39a02443 Improve test framework
Add 'wait_until' primitive
Improve option parsing
2012-07-11 16:51:29 +09:30
Jeremy Lakeman
51d66f5d9e Fix compilation for android 2012-07-11 16:05:03 +09:30
Andrew Bettison
38a5717789 Fix 'rhizomeprotocol' test to always PASS 2012-07-11 14:51:25 +09:30
Andrew Bettison
6b1becd328 Fix bug in 'rhizomeprotocol' test
Now it passes about 30% of the time!
2012-07-11 14:22:55 +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
6556637251 Add HH:MM:SS.mmm timestamp to non-Android log entries 2012-07-11 14:18:36 +09:30
Andrew Bettison
a15a9146c3 Improve toprint() and alloca_toprint() 2012-07-11 14:17:53 +09:30
Andrew Bettison
9eeaeb9dab DEBUG_IO logging for all poll() invocations 2012-07-11 14:15:02 +09:30
Andrew Bettison
c7488de510 Add strbuf_helpers.[ch]
Functions to help assemble strbuf contents.
2012-07-11 14:11:59 +09:30
Andrew Bettison
63d1792863 Fix bugs in strbuf_ncat(), strbuf_puts() and strbuf_putc()
Were not advancing the 'current' pointer the entire length of the appended text
2012-07-11 11:41:15 +09:30
Andrew Bettison
69ff860b4f Add rhizome sync logging to 'rhizomeprotocol' test 2012-07-10 20:00:20 +09:30
Andrew Bettison
42744da371 Improve log diagnostics related to rhizome HTTP 2012-07-10 19:59:46 +09:30
Andrew Bettison
e8eab5b27e Improve diagnostics from write_all(), write_nonblock() etc.
Add toprint() function and alloca_toprint() macro.
2012-07-10 19:57:56 +09:30
Andrew Bettison
2c1c44c4fe Add strbuf_trunc() primitive, fix bug in strbuf_substr() 2012-07-10 19:36:25 +09:30