Changeset 22219 in vbox for trunk/src/VBox/Devices/Network/DrvNAT.cpp
- Timestamp:
- Aug 13, 2009 6:58:11 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 51020
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DrvNAT.cpp
r22217 r22219 170 170 PPDMTHREAD thrNATRx; 171 171 RTSEMEVENT semNATRx; 172 #endif 173 int output_flag; 172 bool fCanOutput; 173 #endif 174 174 } DRVNAT; 175 175 /** Pointer the NAT driver instance data. */ … … 183 183 return VINF_SUCCESS; 184 184 while (pThread->enmState == PDMTHREADSTATE_RUNNING) 185 185 { 186 186 int rc = pThis->pPort->pfnWaitReceiveAvail(pThis->pPort, 0); 187 int new_flag = RT_SUCCESS(rc) ? 1 : 0;188 189 if ( pThis->output_flag == 0 && new_flag == 1)187 bool fHaveRxBuffers = RT_SUCCESS(rc); 188 189 if (!pThis->fCanOutput && fHaveRxBuffers) 190 190 { 191 191 int rc; 192 pThis-> output_flag = new_flag;192 pThis->fCanOutput = fHaveRxBuffers; 193 193 /*we need inform NAT thread*/ 194 194 #ifndef RT_OS_WINDOWS … … 201 201 AssertRelease(rc == TRUE); 202 202 #endif 203 } 204 pThis-> output_flag = new_flag;203 } 204 pThis->fCanOutput = fHaveRxBuffers; 205 205 RTSemEventWait(pThis->semNATRx, RT_INDEFINITE_WAIT); 206 206 } 207 207 return VINF_SUCCESS; 208 208 } … … 221 221 * NAT queue item. 222 222 */ 223 typedef enum SLIRP_EVENT {SLIRP_CHECK, SLIRP_SEND} SLIRP_EVENT; 223 enum 224 { 225 SLIRP_CHECK, 226 SLIRP_SEND 227 }; 228 224 229 typedef struct DRVNATQUEUITEM 225 230 { … … 526 531 #endif /* RT_OS_WINDOWS */ 527 532 #ifdef SLIRP_SPLIT_CAN_OUTPUT 528 drvNATRxWakeup(pThis->pDrvIns, pThis->thrNATRx); 533 drvNATRxWakeup(pThis->pDrvIns, pThis->thrNATRx); 529 534 #endif 530 535 } … … 562 567 { 563 568 PDRVNAT pThis = PDMINS_2_DATA(pDrvIns, PDRVNAT); 569 564 570 if (pThread->enmState == PDMTHREADSTATE_INITIALIZING) 565 571 return VINF_SUCCESS; 566 572 while (pThread->enmState == PDMTHREADSTATE_RUNNING) 567 573 { 568 574 slirp_process_queue(pThis->pNATState); 569 575 } 570 576 return VINF_SUCCESS; 571 577 } … … 589 595 { 590 596 #ifdef SLIRP_SPLIT_CAN_OUTPUT 591 return pThis-> output_flag;597 return pThis->fCanOutput; 592 598 #else 593 599 return 1; … … 840 846 char szNetAddr[16]; 841 847 char szNetwork[32]; /* xxx.xxx.xxx.xxx/yy */ 848 842 849 LogFlow(("drvNATConstruct:\n")); 843 850 … … 986 993 rc = RTSemEventCreate(&pThis->semStatus); 987 994 AssertRC(rc); 988 pThis->output_flag = 0;989 995 #ifdef SLIRP_SPLIT_CAN_OUTPUT 996 pThis->fCanOutput = false; 990 997 rc = PDMDrvHlpPDMThreadCreate(pDrvIns, &pThis->thrNATRx, pThis, drvNATRx, 991 998 drvNATRxWakeup, 128 * _1K, RTTHREADTYPE_IO, "NATRX"); … … 1081 1088 NULL 1082 1089 }; 1083
Note:
See TracChangeset
for help on using the changeset viewer.