VirtualBox

Changeset 14330 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 18, 2008 10:01:14 PM (16 years ago)
Author:
vboxsync
Message:

use slirp_get_timeout_ms() to skip the timeout if possible

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DrvNAT.cpp

    r14305 r14330  
    311311    fd_set  XcptFDs;
    312312    int     nFDs = -1;
     313    unsigned int ms;
    313314# ifdef RT_OS_WINDOWS
    314315    DWORD   event;
     
    339340         */
    340341        slirp_select_fill(pThis->pNATState, &nFDs, &ReadFDs, &WriteFDs, &XcptFDs);
     342        ms = slirp_get_timeout_ms(pThis->pNATState);
    341343# ifndef RT_OS_WINDOWS
    342         struct timeval tv = { 0, 2000 }; /* 2ms */
     344        struct timeval tv = { 0, ms*1000 };
    343345        FD_SET(pThis->PipeRead, &ReadFDs);
    344346        nFDs = ((int)pThis->PipeRead < nFDs ? nFDs : pThis->PipeRead);
    345         int cChangedFDs = select(nFDs + 1, &ReadFDs, &WriteFDs, &XcptFDs, &tv);
     347        int cChangedFDs = select(nFDs + 1, &ReadFDs, &WriteFDs, &XcptFDs, ms ? &tv : NULL);
    346348        if (cChangedFDs >= 0)
    347349        {
     
    358360        }
    359361# else /* RT_OS_WINDOWS */
    360         event = WSAWaitForMultipleEvents(nFDs, phEvents, FALSE, 2 /*ms*/, FALSE);
     362        event = WSAWaitForMultipleEvents(nFDs, phEvents, FALSE, ms ? ms : WSA_INFINITE, FALSE);
    361363        if (   (event < WSA_WAIT_EVENT_0 || event > WSA_WAIT_EVENT_0 + nFDs - 1)
    362364            && event != WSA_WAIT_TIMEOUT)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette