Commit Graph

110 Commits

Author SHA1 Message Date
Andrew Bettison
78a8aaca16 Code improvements while debugging 'dnaprotocol' tests
Use ssize_t and size_t where required by system calls
More stringent checking of errors from system calls
Log the offset when writing to dummy interface file
Clean up many WHY/INFO/DEBUG statements
Convert many fprintf(stderr,...) to DEBUGF()
2012-07-03 15:36:51 +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
Andrew Bettison
fc8df7d5d4 Config options for tick duration 2012-07-02 12:26:01 +09:30
Andrew Bettison
b9836af8a2 Fix debug logging in overlay_interface.c
Also fix bug that closed the logfile when forking the server process.
2012-06-28 17:34:21 +09:30
Andrew Bettison
a5ba1ecacd Clean up debugging code
Only use DEBUG inside "if (debug & DEBUG_BLAH)", not INFO or WARN or WHY!
INFO messages for starting/stopping servald server.
2012-06-28 15:37:36 +09:30
Jeremy Lakeman
29cba17891 Fix rhizome transfers 2012-06-27 16:54:42 +09:30
gardners
1897aa2eef only handle one packet per call to help stats gathering and fairness. 2012-06-25 15:46:34 +09:30
gardners
0c0e5b73e9 reduced debugging output. 2012-06-25 14:46:55 +09:30
gardners
3b6a004cc9 new event scheduler almost working, but after a while can stop
calling overlay_check_ticks alarm for some reason, which causes
queues to congest and bad things to generally happen.
2012-06-22 17:30:21 +09:30
gardners
3e88400e16 cleaned up some debugging. 2012-06-22 16:06:47 +09:30
gardners
895b5873f0 fixed bug cpu time wasting bug for dummynets. 2012-06-22 16:06:46 +09:30
gardners
b675e8eefd removed debugging 2012-06-22 16:06:46 +09:30
gardners
91bccec71d various fixes related to event scheduler.
server main loop is now just fd_poll()
2012-06-22 16:05:50 +09:30
gardners
7ea0c2f3bf fixed bug in dummynet interface handling with new event scheduler. 2012-06-22 16:05:49 +09:30
gardners
5dc6d122a5 significant progress towards clean callback scheduler for poll()
events and timed callbacks.
2012-06-22 16:05:49 +09:30
gardners
2d718a297f reversed changes that broke DNA tests. Improved dnaprotocol
test script slightly.
2012-06-21 17:02:36 +09:30
gardners
136a7bcf56 fixed bug with absolute-path dummynet files.
added pid of producer to dummynet packets.
2012-06-21 16:36:38 +09:30
gardners
5d3e9a21f7 fixed bug with interface specifications to allow - in dummynet paths. 2012-06-21 16:36:37 +09:30
gardners
500b9f9f28 fixed a memory leak, more to find. 2012-06-21 11:33:43 +09:30
Jeremy Lakeman
926d4296c4 Added overall timer for main loop, minor tweaks to order and freq. of processes 2012-06-21 11:33:43 +09:30
gardners
b48fdb6567 added deeper timing checks to reveal that rhizome advertisements
are the slowest part -- need to add caching of manifests so that
we don't hit the database every interface tick.
2012-06-21 11:33:43 +09:30
gardners
0dd5845cdd added instrumentation to detect when servald spends more than 5ms doing
anything.  Reports which bit of the overlay mesh main loop the time was
spent in, to help track it down.
2012-06-15 15:13:45 +09:30
Daniel O'Connor
e8c648c724 Remove reference to non existent variable. 2012-06-15 15:09:21 +09:30
Daniel O'Connor
c5a9321880 Improve debug output (translate IPs & ports into human readable things).
Revert change to use src_addr as this will break other platforms and needs more thought.
Reformat overlay_interface_discover.
2012-06-15 15:09:21 +09:30
Daniel O'Connor
c2411780a9 Cleanup overlay_check_ticks() and overlay_interface_register().
- Remove [f]printf()s.
- Reduce nested if's.
- Add glorious whitespace.
2012-06-08 18:29:27 +09:30
Daniel O'Connor
86c5e6945f Don't force signedness for name in overlay_interface_register().
I can't see any point to forcing the signedness, it causes warnings on platforms with a signed-char by default.
2012-06-08 17:01:50 +09:30
Daniel O'Connor
ea9993dc91 Fix detection on OSX and make detection smarter.
- Fix lsif() on OSX.
- Make lsif() smarter and avoid non-broadcast and no AF_INET addresses.
- Don't run multiple interface detectors, run one at a time until one works.
- Factor out HAVE_IFADDRS_H code into a separate function into lsif.c with the other interface detection routines.
- Prefer HAVE_IFADDRS_H (random bias..)
2012-06-08 16:36:33 +09:30
Daniel O'Connor
8882515d03 Fix compilation on OSX.
- /proc/net/route is Linux only.
- lsif() will work anywhere SIOCGIFCONF is defined.
- Abstract namespace UNIX domain sockets are Linux only.
- Rework code to reduce indent levels.
2012-05-28 15:00:54 +09:30
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
082b517fc9 improved debugging of interface connections. 2012-05-22 10:00:06 +09:30
gardners
4ddb7a5572 fixed bug in overlay_gettime_ms() (start time was 32bits not 64bits,
so strange behaviour resulted, breaking dna number lookup).
2012-05-18 12:55:15 +09:30
gardners
fa8825a3ec try to reuse interface binding socket addresses instead of failing. 2012-05-17 13:14:16 +09:30
Andrew Bettison
f90b21ec78 Implement rhizome config options
rhizome.datastore_path - if not set, reverts to serval instance path
rhizome.enable - if not set, defaults to true
2012-05-15 12:56:10 +09:30
Andrew Bettison
d11258cefc Overhaul debug flags
Config debug flags are now represented as individual items, eg:
   servald config set debug.verbose yes
   servald config set debug.rhizome yes
instead of aggregated, eg:
   servald config set debug verbose,rhizome  <-- no longer works

Added a debug flag "debug.all" that can be set and cleared, over which
individual flag sets/clears take priority.

Slimmed down dna.c by moving some globals and functions to the files where they
are used.

Default command line (help message) is now the new style, not the deprecated
style.
2012-05-14 18:37:32 +09:30
Andrew Bettison
e746557a08 Fix bug in overlay_gettime_ms()
The sequence start time was only getting set in overlay_interface_init(), which
was not always called, or was called after overlay_gettime_ms() had already
been used.

Added FATALF(), FATAL() and FATAL_perror() macros.

Removed a bunch of debug statements no longer needed in monitor.c and server.c.
2012-05-11 10:38:46 +09:30
Andrew Bettison
881576212c Fix all trivial compiler warnings 2012-05-10 18:08:59 +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
cbc367b1f5 Rewrite server start/status/stop commands
Now correctly probes for server process existence using kill(pid, 0)
Status command does not dump config (use "config get" instead)
Output uses JNI cli output fields
Stop command uses 5 Hz wakeup, not busy wait while server exits
2012-05-07 13:49:38 +09:30
gardners
7b520e7a49 fixed various bugs with priorty dispatch of voice traffic.
some debug tweaking etc.
2012-05-07 08:31:53 +09:30
gardners
6718d06421 cleaned up debug output. 2012-05-04 02:40:54 +09:30
gardners
98ea86bde0 added new /proc/net/route method to find interfaces on android
(would you believe that using ifconfig to READ about interfaces
requires ROOT on android).
should also help for interfaces with multiple addresses.
2012-05-03 22:46:00 +09:30
gardners
82ca3dde5d impoved debugging and operation of interface detection
(since it has suddenly decided to fail)
2012-05-03 17:15:05 +09:30
gardners
c9e429e36b and another fd leak. 2012-05-02 02:33:38 +09:30
gardners
cf500085b4 fixed file descriptor leak when trying to bind to an interface. 2012-05-02 02:32:37 +09:30
gardners
da494c7124 removed debugging output 2012-05-01 05:26:28 +09:30
gardners
c9863fe11e lots of fixes to get overlay mesh routing working on linux with
real network interfaces and no dummy interfaces.  neighbour discovery
now seems to work.
2012-04-29 11:56:47 +09:30
gardners
5497b8fd0d fixed broadcast listening bug. 2012-04-28 15:20:06 +09:30