Changeset 49842 in vbox for trunk/src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp
- Timestamp:
- Dec 9, 2013 1:49:46 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 91186
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp
r49839 r49842 18 18 #include "winutils.h" 19 19 20 #include <VBox/com/assert.h> 20 21 #include <VBox/com/com.h> 21 22 #include <VBox/com/listeners.h> … … 26 27 #include <VBox/com/errorprint.h> 27 28 #include <VBox/com/VirtualBox.h> 28 #include <VBox/com/NativeEventQueue.h>29 29 30 30 #include <iprt/net.h> … … 131 131 int run(); 132 132 virtual int init(void); 133 /* @todo: when configuration would be really needed */134 133 virtual int parseOpt(int rc, const RTGETOPTUNION& getOptVal); 135 134 /* VBoxNetNAT always needs Main */ … … 151 150 uint16_t m_u16Mtu; 152 151 netif m_LwipNetIf; 153 /* thread where we're waiting for a frames, no semaphores needed */154 RTTHREAD hThrIntNetRecv;155 152 156 153 /* Our NAT network descriptor in Main */ … … 187 184 INTNETSEG VBoxNetLwipNAT::aXmitSeg[64]; 188 185 186 /** 187 * @note: this work on Event thread. 188 */ 189 189 HRESULT VBoxNetLwipNAT::HandleEvent(VBoxEventType_T aEventType, 190 190 IEvent *pEvent) … … 515 515 516 516 517 /**518 * Intnet-recv thread519 */520 int VBoxNetLwipNAT::intNetThreadRecv(RTTHREAD, void *)521 {522 int rc = VINF_SUCCESS;523 524 /* 1. initialization and connection */525 HRESULT hrc = com::Initialize();526 if (FAILED(hrc))527 return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to initialize COM!");528 529 g_pLwipNat->doReceiveLoop();530 /* 3. deinitilization and termination */531 LogFlowFuncLeaveRC(rc);532 return rc;533 }534 535 536 517 err_t VBoxNetLwipNAT::netifLinkoutput(netif *pNetif, pbuf *pPBuf) 537 518 { … … 699 680 700 681 682 /** This method executed on main thread, only at the end threr're one threads started explcitly (LWIP and later in ::run() 683 * RECV) 684 */ 701 685 int VBoxNetLwipNAT::init() 702 686 { … … 808 792 } 809 793 794 /* this starts LWIP thread */ 810 795 vboxLwipCoreInitialize(VBoxNetLwipNAT::onLwipTcpIpInit, this); 811 812 rc = RTThreadCreate(&g_pLwipNat->hThrIntNetRecv, /* thread handle*/813 VBoxNetLwipNAT::intNetThreadRecv, /* routine */814 NULL, /* user data */815 128 * _1K, /* stack size */816 RTTHREADTYPE_IO, /* type */817 0, /* flags, @todo: waitable ?*/818 "INTNET-RECV");819 AssertRCReturn(rc,rc);820 821 822 796 823 797 LogFlowFuncLeaveRC(rc); … … 963 937 int VBoxNetLwipNAT::run() 964 938 { 965 /* EventQueue processing from VBoxHeadless.cpp */ 966 com::NativeEventQueue *gEventQ = NULL; 967 gEventQ = com::NativeEventQueue::getMainEventQueue(); 968 while(true) 969 { 970 /* XXX:todo: graceful termination */ 971 gEventQ->processEventQueue(0); 972 gEventQ->processEventQueue(500); 973 } 939 /* Father starts receiving thread and enter event loop. */ 940 VBoxNetBaseService::run(); 974 941 975 942 vboxLwipCoreFinalize(VBoxNetLwipNAT::onLwipTcpIpFini, this);
Note:
See TracChangeset
for help on using the changeset viewer.