VirtualBox

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


Ignore:
Timestamp:
Nov 14, 2008 8:28:11 AM (16 years ago)
Author:
vboxsync
Message:

moving slirp_link_* in NAT thread (review required)

File:
1 edited

Legend:

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

    r14196 r14199  
    8181    /*used for wakep of poling thread*/
    8282    RTSEMEVENT              semSndMutex;
     83    RTSEMEVENT              semLinkMutex;
    8384#ifndef RT_OS_WINDOWS
    8485    /** The write end of the control pipe. */
     
    194195        case PDMNETWORKLINKSTATE_UP:
    195196            LogRel(("NAT: link up\n"));
     197#ifndef VBOX_WITH_SIMPLEFIED_SLIRP_SYNC
    196198            slirp_link_up(pThis->pNATState);
    197 #ifdef VBOX_WITH_SIMPLEFIED_SLIRP_SYNC
     199#else
    198200# ifndef RT_OS_WINDOWS
    199201            rc = RTFileWrite(pThis->PipeWrite, "2", 2, NULL);
     
    208210        case PDMNETWORKLINKSTATE_DOWN_RESUME:
    209211            LogRel(("NAT: link down\n"));
     212#ifndef VBOX_WITH_SIMPLEFIED_SLIRP_SYNC
    210213            slirp_link_down(pThis->pNATState);
    211 #ifdef VBOX_WITH_SIMPLEFIED_SLIRP_SYNC
     214#else
    212215# ifndef RT_OS_WINDOWS
    213216            rc = RTFileWrite(pThis->PipeWrite, "2", 2, NULL);
     
    215218# else
    216219            WSASetEvent(pThis->hNetEvent);
     220            RTSemEventWait(pThis->semLinkMutex, RT_INDEFINITE_WAIT);
    217221# endif
    218222#endif
     
    350354        }
    351355        if ((event - WSA_WAIT_EVENT_0) == VBOX_NET_EVENT_INDEX) {
    352                 WSAResetEvent(pThis->hNetEvent);
    353                 break;
    354         }
     356                switch(pThis->enmLinkState) {
     357                    case PDMNETWORKLINKSTATE_UP:
     358                        slirp_link_up(pThis->pNATState);
     359                    break;
     360                    case PDMNETWORKLINKSTATE_DOWN:
     361                    case PDMNETWORKLINKSTATE_DOWN_RESUME:
     362                        slirp_link_down(pThis->pNATState);
     363                    break;
     364                }
     365                WSAResetEvent(pThis->hNetEvent);
     366                RTSemEventSignal(pThis->semLinkMutex);
     367                break;
     368        }
    355369# endif /* RT_OS_WINDOWS */
    356370    }
     
    476490    RTCritSectDelete(&pThis->CritSect);
    477491#else
     492    RTSemEventDestroy(pThis->semLinkMutex);
    478493    RTSemEventDestroy(pThis->semSndMutex);
    479494#endif
     
    709724            pDrvIns->pDrvHlp->pfnPDMPollerRegister(pDrvIns, drvNATPoller);
    710725#else
     726            rc = RTSemEventCreate(&pThis->semLinkMutex);
     727            AssertReleaseRC(rc);
    711728            rc = RTSemEventCreate(&pThis->semSndMutex);
    712729            AssertReleaseRC(rc);
     
    728745            pThis->hSendEvent = WSACreateEvent();
    729746            pThis->hNetEvent = WSACreateEvent();
    730             slirp_register_external_event(pThis->pNATState, pThis->hSendEvent, VBOX_SEND_EVENT_INDEX);
    731             slirp_register_external_event(pThis->pNATState, pThis->hNetEvent, VBOX_NET_EVENT_INDEX);
     747            slirp_register_external_event(pThis->pNATState, pThis->hSendEvent, VBOX_SEND_EVENT_INDEX);
     748            slirp_register_external_event(pThis->pNATState, pThis->hNetEvent, VBOX_NET_EVENT_INDEX);
    732749# endif
    733750
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