Commit graph

54 commits

Author SHA1 Message Date
Malcolm Robb 7ea2e8fdef Bug Fix in modesReadFromClient()
The modesReadFromClient() funtion is called from modesReadFromClients(),
which in turn is called from backgroundTasks(). backgroundTasks() is
called from within the main processing loop.

However, modesReadFromClient() can and does block. It attempts to read
characters from the input stream, and loops whilst there was no error.
This stalls the main RTL processing loop until an error occurs. In order
to support simultaneous local reception (via our RTL dongle) and remote
forwarding (data received from the interweb) we cannot allow this
internet read to stall.

To fix this, in modesReadFromClient() attempt to read a buffer of data
(currently 0x400 bytes). If we get a full buffer of bytes, then process
them, and attempt to read another full buffer. Keep doing thios untill
we read only a partial buffer (less than 0x400 bytes). Process the
partial buffer bytes and return.

This allows us to occasionally process data that is arriving from the
internet (which is buffered anyway in the TCP stack), without blocking
local RTL dongle decoding.
2013-09-20 16:48:15 +01:00
Malcolm Robb 6997715fed Split into separate module files
Ok - this is likely to upset some people. Up until now, the vast
majority of the code has been in just one file - dump1090.c. This file
has grown so that it was approaching of 5000 lines long, and it was
becoming unmanagable. So I've split the file into several modules,
hopefully along fairly logical boundaries. The files are :

1) dump1090.c : Basically just the main() entry function, the help
function, the RTL dongle hardware interface, and a few orphan functions
that  don't really fit anywhere else.

2) mode_s.c : This contains all the mode S / ADSB decoding functions.

3) mode_ac.c : This contains all the mode A & C decoding functions

4) interactive.c : This contains all the functions to maintain an
internal list of aircraft seen over the last period, and functions to
print them out to the local console.

5) net_io.c : This contains all the network input/output functions
allowing data to be passed in/out to/from other receivers, in formats
such as SBS-1/3, Beast, AVR and JavaScript.

Hopefully this should provide an easier way forward if/when more
functions are added.
2013-08-19 18:57:03 +01:00
Malcolm Robb 1ebdd6d7a7 Interactive list aircraft display and delete changes
Create two different Time-To-Live parameters for the interactive display
list.

1) Modes.interactive_display_ttl defines for how long the display of an
aircraft persists after the last received message. The default is
MODES_INTERACTIVE_DISPLAY_TTL, which is set to 60 seconds. This replaces
the previous Modes.interactive_ttl/MODES_INTERACTIVE_TTL settings (which
were also 60 seconds)

2) Add an additional Modes.interactive_delete_ttl  parameter, and
default it to  MODES_INTERACTIVE_DELETE_TTL, shich is set to 300
seconds/5 minutes. This defines for how long an aircraft persists in the
list structure after the last received message before being deleted.

Also tidy up a few comments.
2013-08-19 15:55:17 +01:00
Malcolm Robb 228b770be8 Move declarations into a headed file
This is the start of breaking the main dump109.c file into smaller
modules to make it a bit more maintainable.

Move all the #define and structure declarations into dump1090.h
2013-05-24 23:32:12 +01:00