Repeat READABLE event if there is still data in queue
All checks were successful
/ unit_test (push) Successful in 45s

This commit is contained in:
Daniele Lacamera 2024-11-29 15:02:30 +01:00
parent 4bf4bd3870
commit 4a3f8de4ab

View file

@ -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;
}