main_loop_wait: block indefinitely

- remove qemu_calculate_timeout;

- explicitly size timeout to uint32_t;

- introduce slirp_update_timeout;

- pass NULL as timeout argument to select in case timeout is the maximum
value;

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Paul Brook <paul@codesourcery.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff --git a/libslirp.h b/libslirp.h
index 6ee804d..3f8a9be 100644
--- a/libslirp.h
+++ b/libslirp.h
@@ -15,6 +15,7 @@
                   struct in_addr vnameserver, void *opaque);
 void slirp_cleanup(Slirp *slirp);
 
+void slirp_update_timeout(uint32_t *timeout);
 void slirp_select_fill(int *pnfds, fd_set *readfds, fd_set *writefds,
                        fd_set *xfds);
 
diff --git a/slirp.c b/slirp.c
index aec7250..b61af4e 100644
--- a/slirp.c
+++ b/slirp.c
@@ -261,6 +261,13 @@
     if (nfds < (x)) \
     nfds = (x)
 
+void slirp_update_timeout(uint32_t *timeout)
+{
+    if (!QTAILQ_EMPTY(&slirp_instances)) {
+        *timeout = MIN(1000, *timeout);
+    }
+}
+
 void slirp_select_fill(int *pnfds, fd_set *readfds, fd_set *writefds,
                        fd_set *xfds)
 {