Changeset 67170 in vbox for trunk/src/VBox/Runtime/r3/socket.cpp
- Timestamp:
- May 31, 2017 12:46:24 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 115846
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/socket.cpp
r67151 r67170 1511 1511 AssertReturn(!(fEvents & ~RTSOCKET_EVT_VALID_MASK), VERR_INVALID_PARAMETER); 1512 1512 AssertReturn(RTMemPoolRefCount(pThis) >= (pThis->cUsers ? 2U : 1U), VERR_CALLER_NO_REFERENCE); 1513 int const fdMax = (int)pThis->hNative + 1; 1514 AssertReturn((RTSOCKETNATIVE)(fdMax - 1) == pThis->hNative, VERR_INTERNAL_ERROR_5); 1513 1514 RTSOCKETNATIVE hNative = pThis->hNative; 1515 if (hNative == NIL_RTSOCKETNATIVE) 1516 { 1517 /* Socket is already closed? Possible we raced someone calling rtSocketCloseIt. 1518 Should we return a different status code? */ 1519 *pfEvents = RTSOCKET_EVT_ERROR; 1520 return VINF_SUCCESS; 1521 } 1522 1523 int const fdMax = (int)hNative + 1; 1524 AssertReturn((RTSOCKETNATIVE)(fdMax - 1) == hNative, VERR_INTERNAL_ERROR_5); 1515 1525 1516 1526 *pfEvents = 0; … … 1527 1537 1528 1538 if (fEvents & RTSOCKET_EVT_READ) 1529 FD_SET( pThis->hNative, &fdsetR);1539 FD_SET(hNative, &fdsetR); 1530 1540 if (fEvents & RTSOCKET_EVT_WRITE) 1531 FD_SET( pThis->hNative, &fdsetW);1541 FD_SET(hNative, &fdsetW); 1532 1542 if (fEvents & RTSOCKET_EVT_ERROR) 1533 FD_SET( pThis->hNative, &fdsetE);1543 FD_SET(hNative, &fdsetE); 1534 1544 1535 1545 int rc; … … 1545 1555 if (rc > 0) 1546 1556 { 1547 if (pThis->hNative != NIL_RTSOCKETNATIVE)1557 if (pThis->hNative == hNative) 1548 1558 { 1549 if (FD_ISSET( pThis->hNative, &fdsetR))1559 if (FD_ISSET(hNative, &fdsetR)) 1550 1560 *pfEvents |= RTSOCKET_EVT_READ; 1551 if (FD_ISSET( pThis->hNative, &fdsetW))1561 if (FD_ISSET(hNative, &fdsetW)) 1552 1562 *pfEvents |= RTSOCKET_EVT_WRITE; 1553 if (FD_ISSET( pThis->hNative, &fdsetE))1563 if (FD_ISSET(hNative, &fdsetE)) 1554 1564 *pfEvents |= RTSOCKET_EVT_ERROR; 1565 rc = VINF_SUCCESS; 1555 1566 } 1556 1557 rc = VINF_SUCCESS; 1567 else 1568 { 1569 /* Socket was closed while we waited (rtSocketCloseIt). Different status code? */ 1570 *pfEvents = RTSOCKET_EVT_ERROR; 1571 rc = VINF_SUCCESS; 1572 } 1558 1573 } 1559 1574 else if (rc == 0)
Note:
See TracChangeset
for help on using the changeset viewer.