summary refs log tree commit diff stats
path: root/slirp/sbuf.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2012-04-02 09:46:45 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2012-04-02 09:46:45 -0500
commitcefc898806e0346eef87d15ddaac9475b57b7d84 (patch)
treece4a6312d22ba96fe33fd4c5f1f2306807a07422 /slirp/sbuf.c
parentaba8e41e8666e4c0287cef1f6298985d4e03211d (diff)
parent86073017e384b65a4b568da25e5873fd2e5e4db5 (diff)
downloadfocaccia-qemu-cefc898806e0346eef87d15ddaac9475b57b7d84.tar.gz
focaccia-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