Changeset 28143 in vbox for trunk/src/VBox/Devices/Network/DrvNAT.cpp
- Timestamp:
- Apr 9, 2010 1:50:54 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DrvNAT.cpp
r28138 r28143 220 220 221 221 222 static void drvNATNotifyNATThread(PDRVNAT pThis); 223 static DECLCALLBACK(void) drvNATSlowTimer(PPDMDRVINS pDrvIns, PTMTIMER pTimer, void *pvUser); 224 static DECLCALLBACK(void) drvNATFast(PPDMDRVINS pDrvIns, PTMTIMER pTimer, void *pvUser); 225 226 227 228 static DECLCALLBACK(void) drvNATSlowTimer(PPDMDRVINS pDrvIns, PTMTIMER pTimer, void *pvUser) 229 { 230 Assert(pvUser); 231 PDRVNAT pThis = (PDRVNAT)pvUser; 232 drvNATNotifyNATThread(pThis); 233 } 234 235 static DECLCALLBACK(void) drvNATFastTimer(PPDMDRVINS pDrvIns, PTMTIMER pTimer, void *pvUser) 236 { 237 Assert(pvUser); 238 PDRVNAT pThis = (PDRVNAT)pvUser; 239 drvNATNotifyNATThread(pThis); 240 } 222 /******************************************************************************* 223 * Internal Functions * 224 *******************************************************************************/ 225 static void drvNATNotifyNATThread(PDRVNAT pThis, const char *pszWho); 226 241 227 242 228 … … 323 309 { 324 310 drvNATRecvWakeup(pThis->pDrvIns, pThis->pRecvThread); 325 drvNATNotifyNATThread(pThis );311 drvNATNotifyNATThread(pThis, "drvNATUrgRecvWorker"); 326 312 } 327 313 } … … 335 321 STAM_PROFILE_START(&pThis->StatNATRecvWait, b); 336 322 337 while (ASMAtomicReadU32(&pThis->cUrgPkt) != 0)323 while (ASMAtomicReadU32(&pThis->cUrgPkt) != 0) 338 324 { 339 325 rc = RTSemEventWait(pThis->EventRecv, RT_INDEFINITE_WAIT); 340 326 if ( RT_FAILURE(rc) 341 && ( rc == VERR_TIMEOUT342 327 && ( rc == VERR_TIMEOUT 328 || rc == VERR_INTERRUPTED)) 343 329 goto done_unlocked; 344 330 } … … 354 340 } 355 341 else if ( RT_FAILURE(rc) 356 && (rc != VERR_TIMEOUT357 && rc != VERR_INTERRUPTED))342 && rc != VERR_TIMEOUT 343 && rc != VERR_INTERRUPTED) 358 344 { 359 345 AssertRC(rc); … … 370 356 ASMAtomicDecU32(&pThis->cPkt); 371 357 372 drvNATNotifyNATThread(pThis );358 drvNATNotifyNATThread(pThis, "drvNATRecvWorker"); 373 359 374 360 STAM_PROFILE_STOP(&pThis->StatNATRecvWait, b); … … 525 511 pSgBuf->cSegs = 1; 526 512 527 #if 1/* poison */513 #if 0 /* poison */ 528 514 memset(pSgBuf->aSegs[0].pvSeg, 'F', pSgBuf->aSegs[0].cbSeg); 529 515 #endif … … 562 548 if (RT_SUCCESS(rc)) 563 549 { 564 drvNATNotifyNATThread(pThis );550 drvNATNotifyNATThread(pThis, "drvNATNetworkUp_SendBuf"); 565 551 return VINF_SUCCESS; 566 552 } … … 594 580 * Get the NAT thread out of poll/WSAWaitForMultipleEvents 595 581 */ 596 static void drvNATNotifyNATThread(PDRVNAT pThis )582 static void drvNATNotifyNATThread(PDRVNAT pThis, const char *pszWho) 597 583 { 598 584 int rc; 599 585 #ifndef RT_OS_WINDOWS 600 /* kick select() */586 /* kick poll() */ 601 587 rc = RTFileWrite(pThis->PipeWrite, "", 1, NULL); 602 588 #else … … 664 650 if (RT_LIKELY(rc == VERR_TIMEOUT)) 665 651 { 666 drvNATNotifyNATThread(pThis );652 drvNATNotifyNATThread(pThis, "drvNATNetworkUp_NotifyLinkChanged"); 667 653 rc = RTReqWait(pReq, RT_INDEFINITE_WAIT); 668 654 AssertRC(rc); … … 771 757 * XXX:Make it reading exactly we need to drain the pipe. 772 758 */ 759 /** @todo use RTPipeCreate + RTPipeRead(,biggerbuffer) here, it's 760 * non-blocking. */ 773 761 RTFileRead(pThis->PipeRead, &ch, 1, &cbRead); 774 762 } … … 830 818 PDRVNAT pThis = PDMINS_2_DATA(pDrvIns, PDRVNAT); 831 819 832 drvNATNotifyNATThread(pThis );820 drvNATNotifyNATThread(pThis, "drvNATAsyncIoWakeup"); 833 821 return VINF_SUCCESS; 834 822 } … … 859 847 #endif /* VBOX_WITH_SLIRP_MT */ 860 848 849 850 /** 851 * The callback for the fast (2 ms) NAT timer. 852 * 853 * @param pDrvIns The driver instance. 854 * @param pTimer The timer handle. 855 * @param pvUser The NAT instance data. 856 */ 857 static DECLCALLBACK(void) drvNATFastTimer(PPDMDRVINS pDrvIns, PTMTIMER pTimer, void *pvUser) 858 { 859 PDRVNAT pThis = (PDRVNAT)pvUser; 860 drvNATNotifyNATThread(pThis, "drvNATFastTimer"); 861 } 862 861 863 void slirp_arm_fast_timer(void *pvUser) 862 864 { 863 865 PDRVNAT pThis = (PDRVNAT)pvUser; 864 Assert (pThis);866 AssertPtr(pThis); 865 867 TMTimerSetMillies(pThis->pTmrFast, 2); 866 868 } 867 869 870 /** 871 * The callback for the slow (500 ms) NAT timer. 872 * 873 * @param pDrvIns The driver instance. 874 * @param pTimer The timer handle. 875 * @param pvUser The NAT instance data. 876 */ 877 static DECLCALLBACK(void) drvNATSlowTimer(PPDMDRVINS pDrvIns, PTMTIMER pTimer, void *pvUser) 878 { 879 PDRVNAT pThis = (PDRVNAT)pvUser; 880 drvNATNotifyNATThread(pThis, "drvNATSlowTimer"); 881 } 882 868 883 void slirp_arm_slow_timer(void *pvUser) 869 884 { 870 885 PDRVNAT pThis = (PDRVNAT)pvUser; 871 Assert (pThis);886 AssertPtr(pThis); 872 887 TMTimerSetMillies(pThis->pTmrSlow, 500); 873 888 }
Note:
See TracChangeset
for help on using the changeset viewer.