Skip to content

Commit

Permalink
--devel=debugFlush
Browse files Browse the repository at this point in the history
some more verbose output for people curious about network flushing
  • Loading branch information
wiedehopf committed May 23, 2024
1 parent 0c6f165 commit 49ac85b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions net_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,18 @@ static int flushClient(struct client *c, int64_t now) {
modesCloseClient(c);
return -1;
}
if (bytesWritten > toWrite) {
fprintf(stderr, "%s: send() weirdness: bytesWritten > toWrite: %s: %s port %s (fd %d, SendQ %d, RecvQ %d)\n",
c->service->descr, strerror(err), c->host, c->port,
c->fd, c->sendq_len, c->buflen);
modesCloseClient(c);
return -1;
}
if (bytesWritten < toWrite && Modes.debug_flush) {

fprintTimePrecise(stderr, now);
fprintf(stderr, " %s: send wrote: %d/%d bytes (%s port %s fd %d, SendQ %d)\n", c->service->descr, bytesWritten, toWrite, c->host, c->port, c->fd, c->sendq_len);
}
if (bytesWritten > 0) {
Modes.stats_current.network_bytes_out += bytesWritten;
// Advance buffer
Expand Down
3 changes: 3 additions & 0 deletions readsb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
if (strcasecmp(token[0], "debugPlanefinder") == 0) {
Modes.debug_planefinder = 1;
}
if (strcasecmp(token[0], "debugFlush") == 0) {
Modes.debug_flush = 1;
}
if (strcasecmp(token[0], "omitGlobeFiles") == 0) {
Modes.omitGlobeFiles = 1;
}
Expand Down
1 change: 1 addition & 0 deletions readsb.h
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ struct _Modes
int8_t mode_ac; // Enable decoding of SSR Modes A & C
int8_t mode_ac_auto; // allow toggling of A/C by Beast commands
int8_t debug_net;
int8_t debug_flush;
int8_t debug_no_discard;
int8_t debug_nextra;
int8_t debug_cpr;
Expand Down

0 comments on commit 49ac85b

Please sign in to comment.