Commit Graph

151 Commits

Author SHA1 Message Date
Jeremy Lakeman
df0e20408c Close sockets on poll errors 2012-08-31 15:04:06 +09:30
Jeremy Lakeman
aa5706f9d7 Refactor routing node information to use new subscriber tree 2012-08-31 15:03:07 +09:30
Jeremy Lakeman
dcb2da45fa Allow for audio to arrive in variable sized blocks 2012-08-13 16:35:30 +09:30
Jeremy Lakeman
3ab79d8e5b Pass phone numbers in vomp call initiation 2012-08-13 14:01:57 +09:30
Jeremy Lakeman
2bd26dfcdb Send monitor dna response with my sid in uri 2012-08-12 16:03:18 +09:30
Jeremy Lakeman
6981e7e2c2 Allow monitor clients to resolve did's 2012-08-10 15:29:19 +09:30
Jeremy Lakeman
f059546eb0 Improve monitor client interface and vomp for asterisk channel driver 2012-08-09 13:32:08 +09:30
Jeremy Lakeman
736a8f43c0 Refactor towards changing the vomp monitor interface 2012-08-09 13:32:08 +09:30
Jeremy Lakeman
fc9a9b337e Wait for vomp client to indicate that ringing has started 2012-08-09 13:30:52 +09:30
Daniel O'Connor
fd1f91db8d Refactor unix domain socket naming to a separate file instead.
Handle selection between normal & abstract sockets in a single place.

overlay_mdp.c tried to have both but this seems like a bug so I've removed the second socket (needs tests).
2012-07-30 11:19:25 +09:30
Jeremy Lakeman
fdc70d7512 Log when a peer becomes reachable or unreachable, edit tests to wait for this message 2012-07-17 18:22:39 +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
735d9a42cc Clean up compile warnings and fix bugs
In monitor_process_command() for "call" command, was not handling SID "*" case
properly, nor checking validity of hex SID.
2012-07-06 10:14:39 +09:30
Jeremy Lakeman
7b8e82baea Refactor vomp call processing to reduce latency 2012-07-05 16:09:33 +09:30
Andrew Bettison
2c87039307 Replace overlay_render_sid() with alloca_tohex_sid()
To eliminate timebomb bugs caused by rotor wraparound
2012-07-03 17:59:30 +09:30
Andrew Bettison
30d51f0314 Tighten up tests and code relating to peer discovery 2012-07-03 17:38:54 +09:30
Jeremy Lakeman
3d39e92628 Setup scheduled alarm per vomp call and send keep alives 2012-07-03 15:50:05 +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
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
Jeremy Lakeman
06f724707d Use message length instead of string length for audio packets 2012-06-26 14:34:39 +09:30
Jeremy Lakeman
64559bdca9 Watch new monitor client connections 2012-06-26 12:20:49 +09:30
gardners
b40a468276 Merge branch 'eventscheduler'
Conflicts:
	monitor.c
	serval.h
2012-06-25 16:50:23 +09:30
Daniel O'Connor
271454aee3 Use WRITE_STR instead of writeLine.
staticise a bunch of variables & functions in monitor-cli.c
2012-06-25 16:24:33 +09:30
Daniel O'Connor
930280a17d Move signal handler setup to main so it's only done once. 2012-06-25 16:24:33 +09:30
Andrew Bettison
a960ed4e8a Clean up compiler warning in monitor.c 2012-06-25 15:00:07 +09:30
Daniel O'Connor
80b972c455 The number of clients we have is not a warning. 2012-06-25 14:01:50 +09:30
Daniel O'Connor
2fe520f7a2 Fix peer credential checking on BSD, replace write(s, m, strlen(m)) with a macro, factor out new monitor socke code.
Note this code has issues with signed/unsigned chars. They should become uint8_t's if they hold binary data, otherwise just char. If they ARE binary then it is broken because it calls strlen() on them.
2012-06-22 20:40:30 +09:30
Daniel O'Connor
41a7588a7f Fix creation of socket name for !linux. Depressingly bind() doesn't fail when you pass it the name of a directory. 2012-06-22 20:40:29 +09:30
gardners
6472ff29c1 fixed monitor interface problem with new event scheduler. 2012-06-22 16:06:46 +09:30
gardners
5dc6d122a5 significant progress towards clean callback scheduler for poll()
events and timed callbacks.
2012-06-22 16:05:49 +09:30
Daniel O'Connor
5103176d39 Remove server_probe() and use daemon() instead of a hand rolled version.
- server_probe() assumes abstract name space sockets.
- The hand rolled daemon doesn't work properly on BSD.
2012-06-22 16:05:43 +09:30
gardners
01712ab67e monitor.socket config option added to allow multiple servald
instances on the same machine without conflicting abstract namespace
unix domain sockets for monitor interface.
2012-06-21 16:36:37 +09:30
Jeremy Lakeman
f6cce7103d Fix error message 2012-06-18 10:59:33 +09:30
Daniel O'Connor
051191ba32 Fix braino in non-Linux code. 2012-05-29 09:48:22 +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
Andrew Bettison
8ec2fe53d4 Silence 'status unused' compiler warning 2012-05-25 15:59:57 +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
6a83f2434f cleaned up some debug output, among other things. 2012-05-22 17:04:24 +09:30
gardners
e44294ea66 implemented server_probe(int *pid) that used monitor interface
to probe server status.  Also returns PID if running (Linux only).
2012-05-21 20:45:07 +09:30
Jeremy Lakeman
05a430bc3a Fix case of new peer message for consistency 2012-05-21 14:14:24 +09:30
gardners
66bc67fc76 changed space to : in newpeer message for consistency. 2012-05-21 13:06:42 +09:30
gardners
91e0b3ac27 add monitor commands to actually express interest in new peers. 2012-05-21 13:04:54 +09:30
gardners
c18eb2152c fixed bug in MONITOR_PEERS 2012-05-21 12:55:25 +09:30
gardners
27daf02f81 added peer announcment to monitor interface. 2012-05-21 12:47:54 +09:30
gardners
3ea6d4f324 monitor interface announces new peers. 2012-05-21 12:47:53 +09:30
Daniel O'Connor
990a8f3057 Add support for srtuct ucred on BSD.
This requires building with _GNU_SOURCE to get access to struct ucred on Linux. Previously the test failed on every platform except glibc <2.8 or so.

Building with _GNU_SOURCE causes TRUE to be defined so we can't use this as a variable anymore, and MIN/MAX so don't define our own.
2012-05-21 12:22:50 +09:30
gardners
844a480ae7 more trying to reuse socket addresses when stuck. 2012-05-17 13:14:16 +09:30
gardners
d74afa9ac2 added some debugging to help solve the non-responsive issue that
Jeremy found.
2012-05-14 15:52:15 +09:30
gardners
0b5a9665b2 first cut code for sending monitor socket announcements when
rhizome bundles are received.
2012-05-12 07:24:52 +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
gardners
7b82ccbd7b work on bypass-audio.
CALLSTATUS monitor message has gained a field, thus changing
API for java side.
2012-05-11 08:14:00 +09:30
Andrew Bettison
e39ab01903 Reduce monitor.c debug output a bit 2012-05-11 00:17:02 +09:30
Andrew Bettison
8c1b8920d5 Fix possible cause of SEGV crash in monitor.c 2012-05-10 18:08:59 +09:30
Andrew Bettison
881576212c Fix all trivial compiler warnings 2012-05-10 18:08:59 +09:30
Andrew Bettison
f1e23d463b Improve disgnostic messages from monitor.c 2012-05-09 19:06:17 +09:30
gardners
dbb9b4930f removed some more debugging. 2012-05-09 07:40:29 +09:30
gardners
fbd19db931 stripped out lots of debugging for audio frame handling ready for
audio-streaming of call.
2012-05-09 07:38:34 +09:30
gardners
8aae21232f fix to stop runaway last update time that was squelching keepalive
messages.
2012-05-08 15:58:37 +09:30
gardners
b198db38b9 fixed various bugs in monitor-cli. 2012-05-08 15:47:39 +09:30
gardners
4fa63e61bc improved monitor-cli.c to auto-dial a peer and pump audio in. 2012-05-08 14:41:21 +09:30
gardners
8d48b873d6 added line feed to start of all monitor messages to ensure fast
re-sync if data blob is not read correctly.
2012-05-08 12:57:44 +09:30
gardners
171eb75d48 fixed packet size calculation bug. 2012-05-07 16:50:49 +09:30
gardners
3e9fcffd58 reversed previous commit, as it makes the monitor interface too
chatty, and doesn't help detect loss of servald connection, anyway.
2012-05-07 09:10:35 +09:30
gardners
4ebbb7b3bf added dummy keep alive for null call to make it easier to track
death of calls.
2012-05-07 09:08:56 +09:30
gardners
ecc271c7a3 added call state keepalive so that UI can positively detect when
a call has been destroyed, but has not been realised.
2012-05-07 09:01:46 +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
602c00efd7 fixed bugs in handling of audio. 2012-05-06 22:23:58 +09:30
gardners
04599091d1 improved debugging of closed sockets 2012-05-05 19:28:31 +09:30
gardners
9ce7058cd0 ignore ENOTRECOVERABLE? 2012-05-05 19:10:28 +09:30
gardners
6f363db8f1 added useful message for when closing due to incorrect uid. 2012-05-05 19:06:30 +09:30
gardners
be806088b3 CALLSTATUS message now contains more information (SIDs and DIDs) 2012-05-05 03:58:42 +09:30
gardners
6bc8f5643f better handling of disconnections by monitor clients. 2012-05-04 03:58:34 +09:30
gardners
4f09ccebdc further work towards working monitor interface.
sending DTMF works now, and DTMF packets are received back.
2012-05-04 03:44:41 +09:30
gardners
175a079c0c monitor call/hangup/pickup commands now work. 2012-05-04 03:24:53 +09:30
gardners
91d875d70a fixed various bugs in servald monitor. now receives commands,
and can act on them.
2012-05-04 03:16:06 +09:30
gardners
26ef52cf99 and a bug fix for the above. 2012-05-03 17:04:47 +09:30
gardners
c981b8c28a further monitor client debuggin improvements 2012-05-03 17:04:20 +09:30
gardners
0d899b97d3 improved debugging of when we close our end of client connection. 2012-05-03 17:02:57 +09:30
gardners
f1ac067d4f removed excess debug. 2012-05-03 16:21:14 +09:30
gardners
11132c40c9 fixed big fat nasty socket handling bug. 2012-05-03 16:16:36 +09:30
gardners
f5c3ea024e added debug output to see whether we are getting data back from
java side.
2012-05-03 15:23:42 +09:30
Andrew Bettison
490d9ef472 Only define struct ucred if <sys/socket.h> does not provide it 2012-05-03 14:50:14 +09:30
gardners
75e925a8b5 added some debug for monitor interface. 2012-05-03 14:41:18 +09:30
gardners
ac9cbb4e51 removed debugging now that accept doesn't block 2012-05-03 13:42:41 +09:30
gardners
29a7c20160 fixed a blocking io problem. 2012-05-03 13:37:18 +09:30
gardners
61aa3994b6 try to force accept to be non-blocking. 2012-05-03 13:29:48 +09:30
gardners
9dedb6fd06 more debugging to find why servald blocks after accepting a
monitor client.
2012-05-03 13:19:11 +09:30
gardners
4bbe250595 make sure monitor sockets are nonblocking before doing anything
to them.
2012-05-03 13:04:17 +09:30
gardners
5d6f2b0517 added note about path name length calculation for unix domain
abstract socket.
2012-05-03 12:35:16 +09:30
gardners
f1c6b74235 fixed struct ucred handling for android 2012-05-03 12:20:52 +09:30
gardners
01e81200d0 adding credentials check for abstract name space unix domain socket
for monitor service.
2012-05-03 12:11:13 +09:30
gardners
2e549a0f96 Switching to abstract name space for socket to get around
permission denied errors.
2012-05-03 11:10:23 +09:30
gardners
0c060ce782 found real cause and fixed for poll()/linux bug (forgot to listen) 2012-05-03 04:00:26 +09:30
gardners
eb8e34bcde make sure monitor interface announces creation of new calls. 2012-05-03 03:41:26 +09:30
gardners
25f81aeaaf fixed bug with cancelling calls due to lack of listeners.
worked around poll() with accept() unix domain socket linux bug.
generally hooked in the unix domain stream socket interface for
monitoring calls (and later rhizome).
2012-05-03 03:37:03 +09:30
gardners
eb8ffeb71f progress towards monitor interface for following calls. 2012-05-03 03:00:34 +09:30