aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libslirp.h3
-rw-r--r--src/slirp.c7
2 files changed, 8 insertions, 2 deletions
diff --git a/src/libslirp.h b/src/libslirp.h
index 5760d53..8e4ea33 100644
--- a/src/libslirp.h
+++ b/src/libslirp.h
@@ -68,7 +68,8 @@ typedef struct SlirpCb {
void (*register_poll_fd)(int fd, void *opaque);
/* Unregister a fd */
void (*unregister_poll_fd)(int fd, void *opaque);
- /* Kick the io-thread, to signal that new events may be processed */
+ /* Kick the io-thread, to signal that new events may be processed because some TCP buffer
+ * can now receive more data, i.e. slirp_socket_can_recv will return 1. */
void (*notify)(void *opaque);
} SlirpCb;
diff --git a/src/slirp.c b/src/slirp.c
index 0583e5b..378a70b 100644
--- a/src/slirp.c
+++ b/src/slirp.c
@@ -613,7 +613,10 @@ void slirp_pollfds_fill(Slirp *slirp, uint32_t *timeout,
/*
* Set for reading (and urgent data) if we are connected, can
- * receive more, and we have room for it XXX /2 ?
+ * receive more, and we have room for it.
+ *
+ * If sb is already half full, we will wait for the guest to consume it,
+ * and notify again in sbdrop() when the sb becomes less than half full.
*/
if (CONN_CANFRCV(so) &&
(so->so_snd.sb_cc < (so->so_snd.sb_datalen / 2))) {
@@ -1359,6 +1362,8 @@ size_t slirp_socket_can_recv(Slirp *slirp, struct in_addr guest_addr,
}
if (!CONN_CANFRCV(so) || so->so_snd.sb_cc >= (so->so_snd.sb_datalen / 2)) {
+ /* If the sb is already half full, we will wait for the guest to consume it,
+ * and notify again in sbdrop() when the sb becomes less than half full. */
return 0;
}