Andrew Bettison
a9d3a1387c
Issue #30 , rewrite Rhizome fetch queues and slots
...
Causes SEGV in rhizomestress test.
2012-10-23 18:10:20 +10:30
Andrew Bettison
65ea612e27
Fix bugs revealed by Rhizome stress test
...
Overhauled the file fetch queue logic in rhizome_fetch.c.
Now the 'rhizomeprotocol' stress test passes in approximately 5 minutes on my
2009-vintage Dell laptop.
Added a call to rhizome_enqueue_suggestions() in rhizome_fetch_close() so that
a new Rhizome GET request is sent as soon as a fetch slot becomes free, instead
of waiting for the (default 5 second) timer to trigger the next GET.
2012-10-18 17:30:22 +10:30
Andrew Bettison
5ee82689d2
Start fixing Rhizome stress bugs
...
This commit does not compile.
2012-10-18 11:56:02 +10:30
Jeremy Lakeman
8b9505670d
Fix handling of socket closure on OSX
2012-10-08 16:53:52 +10:30
Andrew Bettison
89343c69cd
Merge branch 'rhizomedirect' into 'master'
2012-10-05 17:45:30 +09:30
Andrew Bettison
2e7d19a3f7
Issue #9 , fix rhizome direct push and sync tests
...
The "rhizome direct push" command (and also sync) was not waiting for the
server's HTTP response, so it was exiting before the server had finished
storing the bundle, which led to a race with the subsequent "assert
bundle_received_by" test. Fixed by adding the missing code to receive the HTTP
response.
Refactored the code used for parsing HTTP responses in rhizome_fetch.c, and
used it in rhizome_direct_http.c.
2012-10-04 17:38:33 +09:30
gardners
d43db3335c
Looks like rhizome direct http pull works now.
...
But tests don't yet pass ... #9
2012-10-03 15:50:43 +02:00
gardners
25a64b5485
fixed some more bugs in rhizome direct http pull.
...
Now actually triggers the http request to obtain the file, but
the peer address is 0.0.0.0:0. Investigating. #9
2012-10-03 15:50:43 +02:00
gardners
81cc9ddb45
more work on rhizome direct http pull. Now passing all the right
...
data we need to allow the prefix2manifest reception to launch
the file body request via normal rhizome http fetch process. #9
2012-10-03 15:50:43 +02:00
gardners
17de56a04c
fixed some problems with the rhizome direct http pull setup code.
...
still working on remaining issues. #9
2012-10-03 15:50:43 +02:00
gardners
a81dafa180
work towards making rhizome direct http pull work. #9
2012-10-03 15:49:40 +02:00
Andrew Bettison
5fed0460e1
Issue #9 , 'rhizomeprotocol' HttpImport test now passes
...
Any HTTP client can import a bundle into Rhizome using a PUSH request.
2012-10-02 17:15:14 +09:30
Andrew Bettison
cc9cb8d827
Issue #9 , fix old 'rhizomeprotocol' test failures
...
Now only the five new Rhizome Direct tests fail.
2012-10-02 16:32:48 +09:30
Andrew Bettison
17ef2249e4
Issue #9 , rewrite rhizome_import_bundle()
...
Objective is to avoid having to call system("servald rhizome import ...") to
handle a Rhizome direct POST /rhizome/bundle request. Antiquated code in and
around rhizome_import_bundle() needs much cleaning up, as indicated by some
TODO comments. Invocations must unnecessarily write the manifest into a file,
when they already have it in memory, ready to pass to the function.
All the 'rhizomeops' tests pass, but two 'rhizomeprotocol' tests are broken
by the changes in this commit.
2012-09-28 17:55:43 +09:30
Andrew Bettison
76401bd31b
Improve some Rhizome debug logging code
2012-09-27 15:34:13 +09:30
Jeremy Lakeman
ac3864ff20
Reuse command line parsing framework with monitor interface
2012-09-25 13:31:34 +09:30
Andrew Bettison
45e3d1d078
Add more debug to Rhizome fetch code
...
To help investigate issue #16 , 'rhizomeprotocol' test case 1 failing on
Solaris.
2012-09-13 14:43:47 +09:30
Jeremy Lakeman
df0e20408c
Close sockets on poll errors
2012-08-31 15:04:06 +09:30
Andrew Bettison
385e2bdb4e
Improve Rhizome INFO messages
2012-08-17 19:42:11 +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
Andrew Bettison
04b95d2590
Merge branch 'andrew' into 'master'
2012-07-25 18:04:16 +09:30
Andrew Bettison
0e5c5e0e98
More work on dnahelper, almost done
...
Servald starts DNA helper, receives startup ACK, sends requests, receives
responses, handles malformed helper responses, echoes dnahelper stderr lines to
log, sends MDP reply packet, waits for dead helper process, all asynchronously.
Shuts down helper process during servald shutdown.
Remaining issues:
- Does not impose a timeout on helper responses.
- Only the first URI is reported by the "dna lookup" command.
2012-07-20 18:17:43 +09:30
Jeremy Lakeman
1d53726b7b
Merge remote-tracking branch 'origin/master'
...
Conflicts:
rhizome_fetch.c
rhizome_http.c
testframework.sh
2012-07-17 15:39:55 +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
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
Jeremy Lakeman
c09582a220
Transfer should work for small files that arrive with the headers
2012-07-13 13:44:05 +09:30
Jeremy Lakeman
0255d7938e
Transfer should work for small files that arrive with the headers
2012-07-13 12:30:19 +09:30
Jeremy Lakeman
27c24f377e
Add deadline time for alarm prioritisation
2012-07-13 12:18:45 +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
ff2c98afb3
Add "rhizome.fetch_interval_ms" config option
2012-07-11 16:51:30 +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
42744da371
Improve log diagnostics related to rhizome HTTP
2012-07-10 19:59:46 +09:30
Andrew Bettison
86eb482ed9
Replace macros with functions
...
SET_NONBLOCKING(), SET_BLOCKING(), WRITE_STR() are now set_nonblock(),
set_block() and write_str() respectively, all of which log an error before
returning -1. There are other useful methods: write_all() treats anything less
than all bytes written as an error; write_nonblock() treats EAGAIN and EINTR as
zero bytes written, and a combination: write_all_nonblock().
2012-07-10 16:33:39 +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
Jeremy Lakeman
132d3a6f9b
rename profiling structure
2012-07-02 16:04:00 +09:30
Jeremy Lakeman
e705696896
separate statistics gathering from the scheduler structure
2012-07-02 15:20:30 +09:30
Jeremy Lakeman
89566e4d3d
Refactor how functions are scheduled or file handes are watched
2012-07-02 13:19:54 +09:30
Jeremy Lakeman
89d3923557
Reduce log spam
2012-06-28 11:13:52 +09:30
Jeremy Lakeman
29cba17891
Fix rhizome transfers
2012-06-27 16:54:42 +09:30
gardners
baf8543def
added cache for positive and negative rhizome manifest signature
...
verifications to avoid repeating expensive lookups.
not perfect, and not tested.
2012-06-26 21:21:46 +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
Andrew Bettison
3d0038754b
Add HTTP port number to rhizome advertise packet
2012-06-25 18:03:00 +09:30
gardners
b40a468276
Merge branch 'eventscheduler'
...
Conflicts:
monitor.c
serval.h
2012-06-25 16:50:23 +09:30
Andrew Bettison
208b9c15fd
Factor out rhizome_hex_to_bytes() and chartonybl()
2012-06-25 14:51:21 +09:30
gardners
0c0e5b73e9
reduced debugging output.
2012-06-25 14:46:55 +09:30
gardners
5dc6d122a5
significant progress towards clean callback scheduler for poll()
...
events and timed callbacks.
2012-06-22 16:05:49 +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
b31817f564
fixed signed/unsigned comparison bug in rhizome manifest cache lookup
...
that was probably stopping some manifest retrievals for meshms.
debugging tweaks.
2012-05-28 13:51:24 +02:00
gardners
0cccb5bf83
debug cleanup
2012-05-28 13:51:23 +02:00
gardners
6861b9cd1b
bug fix for rhizome manifest cache (hopefully realises when
...
database has been updated now).
2012-05-28 13:51:23 +02:00
Jeremy Lakeman
0f214ed46f
Adjust database schema
2012-05-28 19:24:02 +09:30
gardners
884e427fbb
work towards making manifests only accept UPPERCASE hex strings
...
(mixing them between versions of manifests causes confusion).
2012-05-27 17:56:11 +02:00
gardners
07fc646fed
various fixes to rhizome re-fetch logic after a failed partial fetch
...
(which seems to be what is tripping things up)
2012-05-27 17:29:50 +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
7d345ee2d1
made rhizome manifest cache code a little simpler and saner.
2012-05-26 14:36:12 +02:00
gardners
b0dca7e03f
merged in latest changes from team.
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
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
214d20f27e
Fix a couple of bugs found by clang
2012-05-25 16:29:12 +09:30
Andrew Bettison
c847478140
Add some helpful debug logging
2012-05-24 18:46:33 +09:30
Andrew Bettison
30009c2c71
Fix one cause of manifest struct leakage
2012-05-24 17:28:35 +09:30
Andrew Bettison
3b00110c49
Fix bug in rhizome_bundle_import()
...
Introduced by recent rhizome import path improvements
2012-05-24 13:00:31 +09:30
Andrew Bettison
24c00091f5
Fix bug in conversion to rhizome uppercase hex DB keys
2012-05-24 11:37:03 +09:30
Andrew Bettison
fa26b53294
Fix SEGV bug
...
rhizome_write_manifest_file() was not checking for NULL fopen() result
Standardise rhizome "import" directory pathname handling
2012-05-24 11:28:32 +09:30
Andrew Bettison
60e4209b88
Diagnose and fix rhizome MeshMS
2012-05-23 19:01:07 +09:30
Andrew Bettison
54d456e540
Fix and reinstate FORM_RHIZOME_DATASTORE_PATH()
2012-05-23 18:11:34 +09:30
Andrew Bettison
1af9125392
All rhizome database keys are uppercase hex
...
FILES.id, MANIFESTS.id, FILEMANIFESTS.fileid, FILEMANIFESTS.manifestid
Named constants for hex and binary ID sizes
2012-05-23 16:04:00 +09:30
gardners
299cb92952
further output cleanups.
2012-05-22 17:08:12 +09:30
gardners
6a83f2434f
cleaned up some debug output, among other things.
2012-05-22 17:04:24 +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
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
fd343ca5b0
debug fiddles etc.
2012-05-22 11:45:54 +09:30
gardners
a2c3ffde6b
make sure import path exists, use WHY() macros for all output
...
to help debugging on android.
2012-05-22 10:01:17 +09:30
gardners
f562a6361d
completed working around strbuf_* bugs so that rhizome works again.
2012-05-21 22:45:08 +09:30
gardners
3164a76b1e
fixed manifest structure leak when failing to write a manifest.
2012-05-21 22:41:13 +09:30
gardners
231058a218
fixed rhizome transfer bugs.
2012-05-17 11:39:12 +09:30
Andrew Bettison
b02e9b9ac4
Overhaul rhizome datastore path code
...
Create datastore directory and all parent dirs if it does not exist
More robust error checking and buffer overflow protection
New mkdirs() and mkdirsn() functions
2012-05-14 18:37:32 +09:30
gardners
cd65e47be1
fixed segfault bug in rhizome fetch.
...
(serval-node/import directory needs to exist to fetch files,
maybe the code should just make the directory if not present)
2012-05-11 19:07:27 +09:30
Andrew Bettison
836f8332e8
Replace perror() with WHY_perror()
...
Puts more diagnostics to Android log
2012-05-08 14:53:34 +09:30
Andrew Bettison
de88d3db21
Make "dna rhizome add" work for more test cases
...
- adding a bundle using an existing manifest with an incorrect payload should
fail with an error
- adding a bundle using an existing manifest to update the payload to a new
version should succeed
- improve format of "dna rhizome list" output to one bundle per line
2012-04-13 18:03:19 +09:30
Andrew Bettison
575ef91c45
Include <time.h> to eliminate compile warning
2012-04-12 18:33:43 +09:30
gardners
1eb4c34015
Renamed mphlr.h to serval.h
...
(also some temporary debugging has been added in some places)
2012-02-23 12:45:42 +10:30
gardners
423fb589b9
Bug fixes to rhizome manifest:version cache.
...
Lookup now really happens before database query.
2012-01-27 17:18:14 +10:30
gardners
45e8d68522
Added a manifest:version cache to avoid database lookups when being
...
offered manifests, thus saving cpu/energy.
2012-01-27 17:11:18 +10:30
gardners
c0676fd530
Fixed various bugs and memory leaks in rhizome file fetching.
...
Now successfully fetches manifests for files we already have in
the database, using the existing database copy of the file.
Also added filter to stop same file being fetched more than once at
same time..
2012-01-27 16:21:48 +10:30
gardners
41daec5c96
Fixed all zeroes manifestid problem.
...
Removed incorrectly pasted piece of code.
Various debug cleanups along the way.
2012-01-27 15:38:06 +10:30
gardners
cdf1c45da4
Rhizome fetching over http now receives files and imports them.
...
Still some wrinkles to work out.
2012-01-13 21:13:17 +10:30
gardners
f862ba0af6
Rhizome file transfer via http getting close
...
(send side needs to send file body)
2012-01-13 17:21:06 +10:30
gardners
7bcc852279
Fixed bug with non-blocking call to connect() for integrated http client.
...
Cleaned up some debugging stuff.
2012-01-12 17:02:22 +10:30
gardners
bf9f8559f1
Various debug fiddles and conversion from select() to poll()
...
(although poll() still doesn't let us monitor ordinary files
which is silly.)
2012-01-12 16:47:24 +10:30
gardners
abb3021986
Added refactored rhizome code in separate files.
2012-01-12 14:08:24 +10:30