From 4a3f8de4abe9e7db6e2a03b7d9f416c0ccca9d7d Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Fri, 29 Nov 2024 15:02:30 +0100 Subject: [PATCH] Repeat READABLE event if there is still data in queue --- src/femtotcp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/femtotcp.c b/src/femtotcp.c index 1ebf0b4..2b5086c 100644 --- a/src/femtotcp.c +++ b/src/femtotcp.c @@ -1379,7 +1379,10 @@ int ft_recvfrom(struct ipstack *s, int sockfd, void *buf, size_t len, int flags, return 0; return queue_pop(&ts->sock.tcp.rxbuf, buf, len); } else if (ts->sock.tcp.state == TCP_ESTABLISHED) { - return queue_pop(&ts->sock.tcp.rxbuf, buf, len); + int ret = queue_pop(&ts->sock.tcp.rxbuf, buf, len); + if ((ret > 0) && (queue_len(&ts->sock.tcp.rxbuf) > 0)) + ts->events |= CB_EVENT_READABLE; + return ret; } else { /* Not established */ return -1; }