Patchwork [v1,4/5] slirp: decouple timeout for gpoll

login
register
mail settings
Submitter pingfan liu
Date Aug. 8, 2013, 6:26 a.m.
Message ID <1375943171-1063-5-git-send-email-pingfank@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/265660/
State New
Headers show

Comments

pingfan liu - Aug. 8, 2013, 6:26 a.m.
In order to decouple with main loop, we fill timeout for gpoll
through slirp's GSource prepare. (Later, after curtime is decoupled,
slirp system will be self-contained, and isolated from main-loop)

Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
 slirp/slirp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Patch

diff --git a/slirp/slirp.c b/slirp/slirp.c
index 37244be..ecc4d88 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -260,9 +260,6 @@  void slirp_cleanup(Slirp *slirp)
 
 void slirp_update_timeout(uint32_t *timeout)
 {
-    if (!QTAILQ_EMPTY(&slirp_instances)) {
-        *timeout = MIN(1000, *timeout);
-    }
     curtime = qemu_get_clock_ms(rt_clock);
 }
 
@@ -273,6 +270,7 @@  gboolean slirp_prepare(GSource *source, gint *time)
     struct socket *so, *so_next;
     int events = 0;
 
+    *time = MIN(1000, *time);
     /*
      * *_slowtimo needs calling if there are IP fragments
      * in the fragment queue, or there are TCP connections active