Skip to content

Commit

Permalink
--devel=forwardMinMessages,2
Browse files Browse the repository at this point in the history
require minimum number of messages for a plane needed to forward
messages for it
will not affect non-aircraft messages
  • Loading branch information
wiedehopf committed Jul 11, 2024
1 parent 1ed7c88 commit 0043344
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
13 changes: 10 additions & 3 deletions net_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -5765,17 +5765,24 @@ static void outputMessage(struct modesMessage *mm) {
if (Modes.filterDF && (mm->sbs_in || !(Modes.filterDFbitset & (1 << mm->msgtype)))) {
return;
}

struct aircraft *ac = mm->aircraft;

if (ac && ac->messages < Modes.net_forward_min_messages) {
return;
}

int noforward = (mm->timestamp == MAGIC_NOFORWARD_TIMESTAMP) && !Modes.beast_forward_noforward;
int64_t orig_ts = mm->timestamp;
if (Modes.beast_set_noforward_timestamp) {
mm->timestamp = MAGIC_NOFORWARD_TIMESTAMP;
}

struct aircraft *ac = mm->aircraft;

// Suppress the first message when using an SDR
// messages with crc 0 have an explicit checksum and are more reliable, don't suppress them when there was no CRC fix performed
if (Modes.net && !mm->sbs_in && (Modes.net_only || Modes.net_verbatim || (mm->crc == 0 && mm->correctedbits == 0) || (ac && ac->messages > 1) || mm->msgtype == DFTYPE_MODEAC)) {
if (Modes.net && !mm->sbs_in
&& (Modes.net_only || Modes.net_verbatim || (mm->crc == 0 && mm->correctedbits == 0) || (ac && ac->messages > 1) || mm->msgtype == DFTYPE_MODEAC)
) {
int is_mlat = (mm->source == SOURCE_MLAT);

if (mm->jsonPositionOutputEmit && Modes.json_out.connections) {
Expand Down
4 changes: 4 additions & 0 deletions readsb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,10 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
if (strcasecmp(token[0], "messageRateMult") == 0 && token[1]) {
Modes.messageRateMult = atof(token[1]);
}
if (strcasecmp(token[0], "forwardMinMessages") == 0 && token[1]) {
Modes.net_forward_min_messages = atoi(token[1]);
fprintf(stderr, "forwardMinMessages: %u\n", Modes.net_forward_min_messages);
}
if (strcasecmp(token[0], "incrementId") == 0) {
Modes.incrementId = 1;
}
Expand Down
1 change: 1 addition & 0 deletions readsb.h
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ struct _Modes
uint64_t receiver_focus;

uint32_t preambleThreshold;
uint32_t net_forward_min_messages;
int net_output_flush_size; // Minimum Size of output data
int32_t net_output_beast_reduce_interval; // Position update interval for data reduction
int32_t ping_reduce;
Expand Down

0 comments on commit 0043344

Please sign in to comment.