提交 86073017 编写于 作者: J Jan Kiszka

slirp: Signal free input buffer space to io-thread

This massively accelerates slirp reception speed: If data arrives
faster than the guest can read it from the input buffer, the file
descriptor for the corresponding socket was taken out of the fdset for
select. However, the event of the guest reading enough data from the
buffer was not signaled. Thus, the io-thread only noticed this change
on the next time-driven poll. Fix this by kicking the io-thread as
required.
Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
上级 56688961
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册