summaryrefslogtreecommitdiff
path: root/nest
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2022-12-10 17:32:42 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2022-12-10 17:32:42 +0100
commit4c19a8a984c39c7269cf497808735f147243800b (patch)
tree62ae5d14b3225a8366b62d8451c1b55a27aa5986 /nest
parent1124f39f731610687eb8fdd6d7079c20063809c1 (diff)
CLI: Fix for long-lived sessions during high loads
When there is a continuos stream of CLI commands, cli_get_command() always returns 1 (there is a new command). Anyway, the socket receive buffer was reset only when there was no command at all, leading to a strange behavior: after a while, the CLI receive buffer came to its end, then read() was called with zero size buffer, it returned 0 which was interpreted as EOF. The patch fixes that by resetting the buffer position after each command and moving remaining data at the beginning of buffer. Thanks to Maria Matejka for examining the bug and for the original bugfix.
Diffstat (limited to 'nest')
-rw-r--r--nest/cli.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/nest/cli.h b/nest/cli.h
index 8a3294c5..3596e37c 100644
--- a/nest/cli.h
+++ b/nest/cli.h
@@ -29,7 +29,7 @@ typedef struct cli {
node n; /* Node in list of all log hooks */
pool *pool;
void *priv; /* Private to sysdep layer */
- byte *rx_buf, *rx_pos, *rx_aux; /* sysdep */
+ byte *rx_buf, *rx_pos; /* sysdep */
struct cli_out *tx_buf, *tx_pos, *tx_write;
event *event;
void (*cont)(struct cli *c);