Index: vl.c =================================================================== RCS file: /cvsroot/qemu/qemu/vl.c,v retrieving revision 1.168 diff -a -u -r1.168 vl.c --- vl.c 9 Apr 2006 01:32:52 -0000 1.168 +++ vl.c 11 Apr 2006 20:56:56 -0000 @@ -3952,8 +3952,11 @@ void main_loop_wait(int timeout) { IOHandlerRecord *ioh, *ioh_next; - fd_set rfds, wfds; + fd_set rfds, wfds, xfds; int ret, nfds; +#if defined(CONFIG_SLIRP) + int slirp_nfds; +#endif struct timeval tv; #ifdef _WIN32 @@ -3967,6 +3970,7 @@ nfds = -1; FD_ZERO(&rfds); FD_ZERO(&wfds); + FD_ZERO(&xfds); for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { if (ioh->fd_read && (!ioh->fd_read_poll || @@ -3988,7 +3992,14 @@ #else tv.tv_usec = timeout * 1000; #endif - ret = select(nfds + 1, &rfds, &wfds, NULL, &tv); +#if defined(CONFIG_SLIRP) + if (slirp_inited) { + slirp_select_fill(&slirp_nfds, &rfds, &wfds, &xfds); + if (slirp_nfds > nfds) + nfds = slirp_nfds; + } +#endif + ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv); if (ret > 0) { /* XXX: better handling of removal */ for(ioh = first_io_handler; ioh != NULL; ioh = ioh_next) { @@ -4000,30 +4011,14 @@ ioh->fd_write(ioh->opaque); } } - } -#ifdef _WIN32 - tap_win32_poll(); -#endif - #if defined(CONFIG_SLIRP) - /* XXX: merge with the previous select() */ - if (slirp_inited) { - fd_set rfds, wfds, xfds; - int nfds; - struct timeval tv; - - nfds = -1; - FD_ZERO(&rfds); - FD_ZERO(&wfds); - FD_ZERO(&xfds); - slirp_select_fill(&nfds, &rfds, &wfds, &xfds); - tv.tv_sec = 0; - tv.tv_usec = 0; - ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv); - if (ret >= 0) { + if (slirp_inited) slirp_select_poll(&rfds, &wfds, &xfds); - } +#endif } + +#ifdef _WIN32 + tap_win32_poll(); #endif if (vm_running) {