OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #include "webrtc/base/physicalsocketserver.h" | 10 #include "webrtc/base/physicalsocketserver.h" |
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1573 iterators_.push_back(&end); // Don't iterate over new dispatchers. | 1573 iterators_.push_back(&end); // Don't iterate over new dispatchers. |
1574 while (i < end) { | 1574 while (i < end) { |
1575 Dispatcher* disp = dispatchers_[i++]; | 1575 Dispatcher* disp = dispatchers_[i++]; |
1576 SOCKET s = disp->GetSocket(); | 1576 SOCKET s = disp->GetSocket(); |
1577 if (s == INVALID_SOCKET) | 1577 if (s == INVALID_SOCKET) |
1578 continue; | 1578 continue; |
1579 | 1579 |
1580 WSANETWORKEVENTS wsaEvents; | 1580 WSANETWORKEVENTS wsaEvents; |
1581 int err = WSAEnumNetworkEvents(s, events[0], &wsaEvents); | 1581 int err = WSAEnumNetworkEvents(s, events[0], &wsaEvents); |
1582 if (err == 0) { | 1582 if (err == 0) { |
1583 | |
1584 #if LOGGING | |
1585 { | 1583 { |
1586 if ((wsaEvents.lNetworkEvents & FD_READ) && | 1584 if ((wsaEvents.lNetworkEvents & FD_READ) && |
1587 wsaEvents.iErrorCode[FD_READ_BIT] != 0) { | 1585 wsaEvents.iErrorCode[FD_READ_BIT] != 0) { |
1588 LOG(WARNING) << "PhysicalSocketServer got FD_READ_BIT error " | 1586 LOG(WARNING) << "PhysicalSocketServer got FD_READ_BIT error " |
1589 << wsaEvents.iErrorCode[FD_READ_BIT]; | 1587 << wsaEvents.iErrorCode[FD_READ_BIT]; |
1590 } | 1588 } |
1591 if ((wsaEvents.lNetworkEvents & FD_WRITE) && | 1589 if ((wsaEvents.lNetworkEvents & FD_WRITE) && |
1592 wsaEvents.iErrorCode[FD_WRITE_BIT] != 0) { | 1590 wsaEvents.iErrorCode[FD_WRITE_BIT] != 0) { |
1593 LOG(WARNING) << "PhysicalSocketServer got FD_WRITE_BIT error " | 1591 LOG(WARNING) << "PhysicalSocketServer got FD_WRITE_BIT error " |
1594 << wsaEvents.iErrorCode[FD_WRITE_BIT]; | 1592 << wsaEvents.iErrorCode[FD_WRITE_BIT]; |
1595 } | 1593 } |
1596 if ((wsaEvents.lNetworkEvents & FD_CONNECT) && | 1594 if ((wsaEvents.lNetworkEvents & FD_CONNECT) && |
1597 wsaEvents.iErrorCode[FD_CONNECT_BIT] != 0) { | 1595 wsaEvents.iErrorCode[FD_CONNECT_BIT] != 0) { |
1598 LOG(WARNING) << "PhysicalSocketServer got FD_CONNECT_BIT error " | 1596 LOG(WARNING) << "PhysicalSocketServer got FD_CONNECT_BIT error " |
1599 << wsaEvents.iErrorCode[FD_CONNECT_BIT]; | 1597 << wsaEvents.iErrorCode[FD_CONNECT_BIT]; |
1600 } | 1598 } |
1601 if ((wsaEvents.lNetworkEvents & FD_ACCEPT) && | 1599 if ((wsaEvents.lNetworkEvents & FD_ACCEPT) && |
1602 wsaEvents.iErrorCode[FD_ACCEPT_BIT] != 0) { | 1600 wsaEvents.iErrorCode[FD_ACCEPT_BIT] != 0) { |
1603 LOG(WARNING) << "PhysicalSocketServer got FD_ACCEPT_BIT error " | 1601 LOG(WARNING) << "PhysicalSocketServer got FD_ACCEPT_BIT error " |
1604 << wsaEvents.iErrorCode[FD_ACCEPT_BIT]; | 1602 << wsaEvents.iErrorCode[FD_ACCEPT_BIT]; |
1605 } | 1603 } |
1606 if ((wsaEvents.lNetworkEvents & FD_CLOSE) && | 1604 if ((wsaEvents.lNetworkEvents & FD_CLOSE) && |
1607 wsaEvents.iErrorCode[FD_CLOSE_BIT] != 0) { | 1605 wsaEvents.iErrorCode[FD_CLOSE_BIT] != 0) { |
1608 LOG(WARNING) << "PhysicalSocketServer got FD_CLOSE_BIT error " | 1606 LOG(WARNING) << "PhysicalSocketServer got FD_CLOSE_BIT error " |
1609 << wsaEvents.iErrorCode[FD_CLOSE_BIT]; | 1607 << wsaEvents.iErrorCode[FD_CLOSE_BIT]; |
1610 } | 1608 } |
1611 } | 1609 } |
1612 #endif | |
1613 uint32_t ff = 0; | 1610 uint32_t ff = 0; |
1614 int errcode = 0; | 1611 int errcode = 0; |
1615 if (wsaEvents.lNetworkEvents & FD_READ) | 1612 if (wsaEvents.lNetworkEvents & FD_READ) |
1616 ff |= DE_READ; | 1613 ff |= DE_READ; |
1617 if (wsaEvents.lNetworkEvents & FD_WRITE) | 1614 if (wsaEvents.lNetworkEvents & FD_WRITE) |
1618 ff |= DE_WRITE; | 1615 ff |= DE_WRITE; |
1619 if (wsaEvents.lNetworkEvents & FD_CONNECT) { | 1616 if (wsaEvents.lNetworkEvents & FD_CONNECT) { |
1620 if (wsaEvents.iErrorCode[FD_CONNECT_BIT] == 0) { | 1617 if (wsaEvents.iErrorCode[FD_CONNECT_BIT] == 0) { |
1621 ff |= DE_CONNECT; | 1618 ff |= DE_CONNECT; |
1622 } else { | 1619 } else { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 break; | 1651 break; |
1655 } | 1652 } |
1656 } | 1653 } |
1657 | 1654 |
1658 // Done | 1655 // Done |
1659 return true; | 1656 return true; |
1660 } | 1657 } |
1661 #endif // WEBRTC_WIN | 1658 #endif // WEBRTC_WIN |
1662 | 1659 |
1663 } // namespace rtc | 1660 } // namespace rtc |
OLD | NEW |