Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support a new 'l'/'L' Beast option; when enabled, send only locally-generated messages #204

Merged
merged 2 commits into from
Oct 8, 2022

Conversation

mutability
Copy link

As an implementation detail, whenever 'L' is enabled, 'V' (verbatim) is also implicitly enabled. (Clients should not rely on this as it will probably change in the future -- they should request both local and verbatim mode if they do want both)

See #202 for background.

…enerated messages.

As an implementation detail, whenever 'L' is enabled, 'V' (verbatim) is also implicitly enabled.
(Clients should not rely on this as it will probably change in the future -- they should
request both local and verbatim mode if they do want both)

See #202 for background.
@mutability
Copy link
Author

@nunojpg does this work as a first step for what you need?

(caution: compiles, but otherwise untested!)

net_io.c Outdated Show resolved Hide resolved
@nunojpg
Copy link

nunojpg commented Oct 7, 2022

Would the following work for a info message? I would submit a PR on top of this.

--- a/net_io.c
+++ b/net_io.c
@@ -339,6 +339,26 @@ static void modesCloseClient(struct client *c) {
 
     autoset_modeac();
 }
+
+static void modesWriteStatusClient(struct client *c) {
+    char str[] =
+        "\x1a\xff"
+        MODES_DUMP1090_VARIANT
+        ","
+        MODES_DUMP1090_VERSION
+        ","
+        "0";
+    str[sizeof(str)-2] = c->local_requested ? 'l' : (c->verbatim_requested ? 'v' : 'n');
+
+#ifndef _WIN32
+    int nwritten = write(c->fd, str, sizeof(str) -1 );
+#else
+    int nwritten = send(c->fd, str, sizeof(str) - 1, 0 );
+#endif
+    if (nwritten != sizeof(str) - 1) {
+        modesCloseClient(c);
+    }
+}
 //
 //=========================================================================
 //
@@ -1220,6 +1240,9 @@ static int handleBeastCommand(struct client *c, char *p) {
         c->local_requested = 1;
         handleOptionsChange(c);
         break;
+    case 'i':
+        modesWriteStatusClient(c);
+        break;
     }
 
     return 0;

@mutability
Copy link
Author

Would the following work for a info message?

Yes that's the rough approach I was thinking of.

I'll merge this PR now so I can get the release out the door and we can work out the details of the info message in a separate PR?

@mutability mutability merged commit 314c00c into dev Oct 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants