rtty: throttle the amount of data being pushed to the server

The socket died when too much data was sent too fast

Fixes: WIFI-12334
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2023-03-14 14:41:08 +01:00
parent ae75067938
commit 792e3a8a2e

View File

@@ -0,0 +1,31 @@
Index: rtty-7.1.4/src/rtty.c
===================================================================
--- rtty-7.1.4.orig/src/rtty.c
+++ rtty-7.1.4/src/rtty.c
@@ -36,6 +36,8 @@
#include "utils.h"
#include "command.h"
+#include <poll.h>
+
extern int force_exit;
extern int connected;
@@ -84,7 +86,7 @@ static void pty_on_read(struct ev_loop *
struct tty *tty = container_of(w, struct tty, ior);
struct rtty *rtty = tty->rtty;
struct buffer *wb = &rtty->wb;
- static uint8_t buf[4096];
+ static uint8_t buf[32* 1024];
int len;
while (1) {
@@ -394,6 +396,8 @@ static void on_net_write(struct ev_loop
if (buffer_length(&rtty->wb) < 1)
ev_io_stop(loop, w);
+
+ poll(NULL, 0, 100);
}
static void on_net_connected(int sock, void *arg)