VirtualBox

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


Ignore:
Timestamp:
Nov 12, 2008 4:16:50 AM (16 years ago)
Author:
vboxsync
Message:

per polling allocation of event array was replaced by on init allocation
sending event registration moved in initialization part

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

Legend:

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

    r14086 r14119  
    303303# else /* RT_OS_WINDOWS */
    304304        phEvents = slirp_get_events(pThis->pNATState);
    305         phEvents[0] = pThis->hSendEvent;
    306305        event = WSAWaitForMultipleEvents(nFDs, phEvents, FALSE, 2 /*ms*/, FALSE);
    307306        AssertRelease(event != WSA_WAIT_FAILED);
     
    696695# else
    697696            pThis->hSendEvent = WSACreateEvent();
     697            slirp_register_external_event(pThis->pNATState, pThis->hSendEvent);
    698698# endif
    699699
  • trunk/src/VBox/Devices/Network/slirp/libslirp.h

    r14028 r14119  
    5151#if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
    5252HANDLE *slirp_get_events(PNATState pData);
     53HANDLE *slirp_register_external_event(PNATState pData, HANDLE hEvent);
    5354#endif
    5455#ifdef __cplusplus
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r14089 r14119  
    222222        WSAStartup(MAKEWORD(2,0), &Data);
    223223    }
     224#ifdef VBOX_WITH_SIMPLEFIED_SLIRP_SYNC
     225    /*XXX:probably should be configurable*/
     226    pData->phEvents = malloc(sizeof(HANDLE) * pData->cMaxEvent);
     227#endif
    224228#endif
    225229
     
    307311         "\n"));
    308312#endif
     313#if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
     314    free(pData->phEvents);
     315#endif
    309316    free(pData);
    310317}
     
    374381                 */
    375382                cElements = 1;
    376                 for (so = tcb.so_next; so != &tcb; so = so_next, cElements++)
    377                         so_next = so->so_next;
    378                 for (so = udb.so_next; so != &udb; so = so_next, cElements++)
    379                         so_next = so->so_next;
    380                 if (pData->phEvents != NULL)
    381                     free(pData->phEvents);
    382                 pData->phEvents = malloc(sizeof(HANDLE) * cElements);
    383383#endif
    384384
     
    400400
    401401#if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
     402                        AssertRelease(cEvents >= pData->cMaxEvent);
    402403                        WSAResetEvent(so->hNetworkEvent);
    403404#endif
     
    501502#else
    502503                                WSAResetEvent(so->hNetworkEvent);
     504                                AssertRelease(cEvents >= pData->cMaxEvent);
    503505                                rc = WSAEventSelect(so->s, so->hNetworkEvent, FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT);
    504506                                AssertRelease(rc != SOCKET_ERROR);
     
    936938        return (pData->phEvents);
    937939}
    938 #endif
     940HANDLE *slirp_register_external_event(PNATState pData, HANDLE hEvent)
     941{
     942        pData->phEvents[0] = hEvent;
     943}
     944#endif
  • trunk/src/VBox/Devices/Network/slirp/slirp_state.h

    r14028 r14119  
    117117    struct socket *udp_last_so;
    118118#if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
     119    int cMaxEvent;
    119120    HANDLE *phEvents;
    120121#endif
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