Changeset 37596 in vbox for trunk/src/VBox/NetworkServices/NAT
- Timestamp:
- Jun 22, 2011 7:30:06 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/NAT/VBoxNetNAT.cpp
r36470 r37596 35 35 #include <iprt/path.h> 36 36 #include <iprt/param.h> 37 #include <iprt/pipe.h> 37 38 #include <iprt/getopt.h> 38 39 #include <iprt/string.h> … … 90 91 HANDLE m_hWakeupEvent; 91 92 #else 92 RT FILE m_PipeWrite;93 RT FILE m_PipeRead;93 RTPIPE m_hPipeWrite; 94 RTPIPE m_hPipeRead; 94 95 #endif 95 96 /** Queue for NAT-thread-external events. */ … … 126 127 #ifndef RT_OS_WINDOWS 127 128 /* kick select() */ 128 rc = RTFileWrite(g_pNAT->m_PipeWrite, "", 1, NULL); 129 size_t cbIgnored; 130 rc = RTPipeWrite(g_pNAT->m_hPipeWrite, "", 1, &cbIgnored); 129 131 #else 130 132 /* kick WSAWaitForMultipleEvents */ … … 170 172 * Create the control pipe. 171 173 */ 172 int fds[2]; 173 if (pipe(&fds[0]) != 0) /** @todo RTPipeCreate() or something... */ 174 { 175 rc = RTErrConvertFromErrno(errno); 176 AssertReleaseRC(rc); 177 return; 178 } 179 m_PipeRead = fds[0]; 180 m_PipeWrite = fds[1]; 174 rc = RTPipeCreate(&m_hPipeRead, &m_hPipeWrite, 0 /*fFlags*/); 175 AssertReleaseRC(rc); 181 176 #else 182 177 m_hWakeupEvent = CreateEvent(NULL, FALSE, FALSE, NULL); /* auto-reset event */ 178 AssertReleaseRC(m_hWakeupEvent != NULL); 183 179 slirp_register_external_event(m_pNATState, m_hWakeupEvent, VBOX_WAKEUP_EVENT_INDEX); 184 180 #endif … … 299 295 #ifndef RT_OS_WINDOWS 300 296 /* kick select() */ 301 rc = RTFileWrite(m_PipeWrite, "", 1, NULL); 297 size_t cbIgnored; 298 rc = RTPipeWrite(m_hPipeWrite, "", 1, &cbIgnored); 302 299 AssertRC(rc); 303 300 #else … … 468 465 unsigned int cMsTimeout = slirp_get_timeout_ms(pThis->m_pNATState); 469 466 470 polls[0].fd = pThis->m_PipeRead;467 polls[0].fd = RTPipeToNative(pThis->m_hPipeRead); 471 468 /* POLLRDBAND usually doesn't used on Linux but seems used on Solaris */ 472 469 polls[0].events = POLLRDNORM|POLLPRI|POLLRDBAND; … … 494 491 if (polls[0].revents & (POLLRDNORM|POLLPRI|POLLRDBAND)) 495 492 { 496 /* drain the pipe */ 497 char ch[1]; 498 size_t cbRead; 499 int counter = 0; 500 /* 493 /* drain the pipe 494 * 495 * Note! 501 496 * drvNATSend decoupled so we don't know how many times 502 497 * device's thread sends before we've entered multiplex, … … 506 501 * deep pipe has been filed before drain. 507 502 * 508 * XXX:Make it reading exactly we need to drain the pipe.509 503 */ 510 RTFileRead(pThis->m_PipeRead, &ch, 1, &cbRead); 504 /** @todo XXX: Make it reading exactly we need to drain the 505 * pipe. */ 506 char ch; 507 size_t cbRead; 508 RTPipeRead(pThis->m_hPipeRead, &ch, 1, &cbRead); 511 509 } 512 510 }
Note:
See TracChangeset
for help on using the changeset viewer.