[hamradio-commits] [dump1090] 89/373: Add --net-ro-size command line switch

Matthew Ernisse mernisse-guest at moszumanska.debian.org
Thu Oct 23 14:58:08 UTC 2014


This is an automated email from the git hooks/post-receive script.

mernisse-guest pushed a commit to branch backport
in repository dump1090.

commit 249c11a4c385ef45eeadf23571c34bc44b10e8c8
Author: Malcolm Robb <Support at ATTAvionics.com>
Date:   Sun Apr 14 22:51:50 2013 +0100

    Add --net-ro-size command line switch
    
    Allow the user to specify the minimum size of raw data to be sent to the
    TCP port. Dump1090 will buffer up raw data until it has at least this
    many bytes to send to the TCP socket.
    
    The default is 0, which means every frame is sent to the TCP socket as
    it is decoded. The maximum value is limited to 1300 bytes.
    
    Note the buffer will  be flushed every 65 ms regardless of the amount of
    data in it so that excessive in transmission do not occur.
---
 dump1090.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/dump1090.c b/dump1090.c
index 1d672e7..2c6907d 100644
--- a/dump1090.c
+++ b/dump1090.c
@@ -192,6 +192,7 @@ struct {
     int net;                        /* Enable networking. */
     int net_only;                   /* Enable just networking. */
     int net_output_sbs_port;        /* SBS output TCP port. */
+    int net_output_raw_size;        /* Minimum Size of the output raw data */     
     int net_output_raw_port;        /* Raw output TCP port. */
     int net_input_raw_port;         /* Raw input TCP port. */
     int net_http_port;              /* HTTP port. */
@@ -311,6 +312,7 @@ void modesInitConfig(void) {
     Modes.net = 0;
     Modes.net_only = 0;
     Modes.net_output_sbs_port = MODES_NET_OUTPUT_SBS_PORT;
+    Modes.net_output_raw_size = 0;
     Modes.net_output_raw_port = MODES_NET_OUTPUT_RAW_PORT;
     Modes.net_input_raw_port = MODES_NET_INPUT_RAW_PORT;
     Modes.net_http_port = MODES_NET_HTTP_PORT;
@@ -342,6 +344,10 @@ void modesInit(void) {
         exit(1);
     }
 
+    // Limit the maximum requested raw output size to less than one Ethernet Block 
+    if (Modes.net_output_raw_size > (MODES_RAWOUT_BUF_FLUSH))
+      {Modes.net_output_raw_size = MODES_RAWOUT_BUF_FLUSH;}
+
     // Clear the buffers that have just been allocated, just in-case
     memset(Modes.icao_cache, 0,   sizeof(uint32_t) * MODES_ICAO_CACHE_LEN * 2);
     memset(Modes.data,       127, MODES_ASYNC_BUF_SIZE);
@@ -2193,7 +2199,7 @@ void modesSendBeastOutput(struct modesMessage *mm) {
     memcpy(p, mm->msg, msgLen);
 
     Modes.rawOutUsed += (msgLen + 9);
-    if (Modes.rawOutUsed >= MODES_RAWOUT_BUF_FLUSH)
+    if (Modes.rawOutUsed >= Modes.net_output_raw_size)
       {
       modesSendAllClients(Modes.ros, Modes.rawOut, Modes.rawOutUsed);
       Modes.rawOutUsed = 0;
@@ -2226,7 +2232,7 @@ void modesSendRawOutput(struct modesMessage *mm) {
     *p++ = '\n';
 
     Modes.rawOutUsed += ((msgLen*2) + 3);
-    if (Modes.rawOutUsed >= MODES_RAWOUT_BUF_FLUSH)
+    if (Modes.rawOutUsed >= Modes.net_output_raw_size)
       {
       modesSendAllClients(Modes.ros, Modes.rawOut, Modes.rawOutUsed);
       Modes.rawOutUsed = 0;
@@ -2616,6 +2622,7 @@ void showHelp(void) {
 "--net                    Enable networking\n"
 "--net-beast              TCP raw output in Beast binary format\n"
 "--net-only               Enable just networking, no RTL device or file used\n"
+"--net-ro-size <size>     TCP raw output minimum size (default: 0)\n"
 "--net-ro-port <port>     TCP raw output listen port (default: 30002)\n"
 "--net-ri-port <port>     TCP raw input listen port  (default: 30001)\n"
 "--net-http-port <port>   HTTP server port (default: 8080)\n"
@@ -2697,6 +2704,8 @@ int main(int argc, char **argv) {
         } else if (!strcmp(argv[j],"--net-only")) {
             Modes.net = 1;
             Modes.net_only = 1;
+        } else if (!strcmp(argv[j],"--net-ro-size") && more) {
+            Modes.net_output_raw_size = atoi(argv[++j]);
         } else if (!strcmp(argv[j],"--net-ro-port") && more) {
             Modes.net_output_raw_port = atoi(argv[++j]);
         } else if (!strcmp(argv[j],"--net-ri-port") && more) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/dump1090.git



More information about the pkg-hamradio-commits mailing list