summaryrefslogtreecommitdiffstats
path: root/slirp/sbuf.c
diff options
context:
space:
mode:
authorAnthony Liguori2012-04-02 16:46:45 +0200
committerAnthony Liguori2012-04-02 16:46:45 +0200
commitcefc898806e0346eef87d15ddaac9475b57b7d84 (patch)
treece4a6312d22ba96fe33fd4c5f1f2306807a07422 /slirp/sbuf.c
parentMerge remote-tracking branch 'stefanha/tracing' into staging (diff)
parentslirp: Signal free input buffer space to io-thread (diff)
downloadqemu-cefc898806e0346eef87d15ddaac9475b57b7d84.tar.gz
qemu-cefc898806e0346eef87d15ddaac9475b57b7d84.tar.xz
qemu-cefc898806e0346eef87d15ddaac9475b57b7d84.zip
Merge remote-tracking branch 'kiszka/queues/slirp' into staging
* kiszka/queues/slirp: slirp: Signal free input buffer space to io-thread w32/slirp: Undefine error constants before their redefinition slirp: use socket_set_nonblock slirp: clean up conflicts with system headers
Diffstat (limited to 'slirp/sbuf.c')
-rw-r--r--slirp/sbuf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/slirp/sbuf.c b/slirp/sbuf.c
index 5a1ccbfadf..637f8fea3d 100644
--- a/slirp/sbuf.c
+++ b/slirp/sbuf.c
@@ -6,6 +6,7 @@
*/
#include <slirp.h>
+#include <main-loop.h>
static void sbappendsb(struct sbuf *sb, struct mbuf *m);
@@ -18,6 +19,8 @@ sbfree(struct sbuf *sb)
void
sbdrop(struct sbuf *sb, int num)
{
+ int limit = sb->sb_datalen / 2;
+
/*
* We can only drop how much we have
* This should never succeed
@@ -29,6 +32,9 @@ sbdrop(struct sbuf *sb, int num)
if(sb->sb_rptr >= sb->sb_data + sb->sb_datalen)
sb->sb_rptr -= sb->sb_datalen;
+ if (sb->sb_cc < limit && sb->sb_cc + num >= limit) {
+ qemu_notify_event();
+ }
}
void