Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions net_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
//
//=========================================================================
//
Expand Down Expand Up @@ -1220,6 +1240,9 @@ static int handleBeastCommand(struct client *c, char *p) {
c->local_requested = 1;
handleOptionsChange(c);
break;
case 'h':
modesWriteStatusClient(c);
break;
}

return 0;
Expand Down