VirtualBox

Changeset 15266 in vbox for trunk/src/VBox/Devices/Network


Ignore:
Timestamp:
Dec 10, 2008 5:21:43 PM (16 years ago)
Author:
vboxsync
Message:

slirp: don't try to receive ICMP every time but only if the event is active

Location:
trunk/src/VBox/Devices/Network
Files:
3 edited

Legend:

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

    r14391 r15266  
    372372        {
    373373            /* only check for slow/fast timers */
    374             slirp_select_poll(pThis->pNATState, NULL, NULL, NULL);
     374            slirp_select_poll(pThis->pNATState, /* fTimeout=*/true, /*fIcmp=*/false);
    375375            continue;
    376376        }
    377377
    378378        /* poll the sockets in any case */
    379         slirp_select_poll(pThis->pNATState, &ReadFDs, &WriteFDs, &XcptFDs);
     379        slirp_select_poll(pThis->pNATState, /* fTimeout=*/false, /* fIcmp=*/(event == WSA_WAIT_EVENT_0));
    380380        /* process _all_ outstanding requests but don't wait */
    381381        RTReqProcess(pThis->pReqQueue, 0);
  • trunk/src/VBox/Devices/Network/slirp/libslirp.h

    r15086 r15266  
    3636                       fd_set *readfds, fd_set *writefds, fd_set *xfds);
    3737
     38#if defined(RT_OS_WINDOWS) && defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC)
     39void slirp_select_poll(PNATState pData, int fTimeout, int fIcmp);
     40#else
    3841void slirp_select_poll(PNATState pData, fd_set *readfds, fd_set *writefds, fd_set *xfds);
     42#endif
    3943
    4044void slirp_input(PNATState pData, const uint8_t *pkt, int pkt_len);
     
    5155
    5256#if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
     57
     58# ifdef VBOX_WITH_SLIRP_ICMP
     59
     60/*
     61 * ICMP handle state change
     62 */
     63#define VBOX_ICMP_EVENT_INDEX           0
     64
    5365/**
    5466 * This event is for
     
    5769 *  - slirp_link_down
    5870 *  - wakeup
    59  *
    60  * The event index should be smaller than VBOX_SOCKET_EVENT_INDEX to ensure
    61  * that we can detect if that event was set (WSAWaitForMultipleEvents()
    62  * returns the index of the first active event).
    6371 */
    64 #define VBOX_WAKEUP_EVENT_INDEX         0
     72#  define VBOX_WAKEUP_EVENT_INDEX       1
    6573
    6674/*
    6775 * UDP/TCP socket state change (socket ready to receive, to send, ...)
    6876 */
    69 #define VBOX_SOCKET_EVENT_INDEX         1
    70 
    71 #ifdef VBOX_WITH_SLIRP_ICMP
    72 /*
    73  * ICMP handle state change
    74  */
    75 #define VBOX_ICMP_EVENT_INDEX         2
     77#  define VBOX_SOCKET_EVENT_INDEX       2
    7678
    7779/*
    7880 * The number of events for WSAWaitForMultipleEvents().
    7981 */
    80 #define VBOX_EVENT_COUNT                3
    81 #else
    82 /*
    83  * The number of events for WSAWaitForMultipleEvents().
    84  */
    85 #define VBOX_EVENT_COUNT                2
     82#  define VBOX_EVENT_COUNT              3
    8683
    87 #endif
     84# else
     85
     86#  define VBOX_WAKEUP_EVENT_INDEX       0
     87#  define VBOX_SOCKET_EVENT_INDEX       1
     88#  define VBOX_EVENT_COUNT              2
     89
     90# endif
    8891
    8992HANDLE *slirp_get_events(PNATState pData);
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r15244 r15266  
    654654}
    655655
     656#if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
     657void slirp_select_poll(PNATState pData, int fTimeout, int fIcmp)
     658#else
    656659void slirp_select_poll(PNATState pData, fd_set *readfds, fd_set *writefds, fd_set *xfds)
     660#endif
    657661{
    658662    struct socket *so, *so_next;
     
    700704    }
    701705#if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
    702     if (!readfds && !writefds && !xfds)
     706    if (fTimeout)
    703707        return; /* only timer update */
    704708#endif
     
    908912#if defined(VBOX_WITH_SLIRP_ICMP)
    909913# if defined(RT_OS_WINDOWS)
    910         sorecvfrom(pData, &pData->icmp_socket);
     914        if (fIcmp)
     915            sorecvfrom(pData, &pData->icmp_socket);
    911916# else
    912917        if (pData->icmp_socket.s != -1 && FD_ISSET(pData->icmp_socket.s, readfds))
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