Chromium Code Reviews| 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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 699 } else if (res == 0) { | 699 } else if (res == 0) { |
| 700 // EOF, so closed. | 700 // EOF, so closed. |
| 701 return true; | 701 return true; |
| 702 } else { // error | 702 } else { // error |
| 703 switch (errno) { | 703 switch (errno) { |
| 704 // Returned if we've already closed s_. | 704 // Returned if we've already closed s_. |
| 705 case EBADF: | 705 case EBADF: |
| 706 // Returned during ungraceful peer shutdown. | 706 // Returned during ungraceful peer shutdown. |
| 707 case ECONNRESET: | 707 case ECONNRESET: |
| 708 return true; | 708 return true; |
| 709 // This should only happen when connecting (and at most once), because | |
| 710 // in all other cases this function is only called if the file | |
| 711 // descriptor is already known to be in the readable state. | |
| 712 case EWOULDBLOCK: | |
| 713 return false; | |
| 709 default: | 714 default: |
| 710 // Assume that all other errors are just blocking errors, meaning the | 715 LOG_ERR(LS_WARNING) << "Unexpected error from recv"; |
| 711 // connection is still good but we just can't read from it right now. | 716 return true; |
|
Taylor Brandstetter
2017/02/09 08:59:47
I don't think this is safe. There are errors besid
| |
| 712 // This should only happen when connecting (and at most once), because | |
| 713 // in all other cases this function is only called if the file | |
| 714 // descriptor is already known to be in the readable state. However, | |
| 715 // it's not necessary a problem if we spuriously interpret a | |
| 716 // "connection lost"-type error as a blocking error, because typically | |
| 717 // the next recv() will get EOF, so we'll still eventually notice that | |
| 718 // the socket is closed. | |
| 719 LOG_ERR(LS_WARNING) << "Assuming benign blocking error"; | |
| 720 return false; | |
| 721 } | 717 } |
| 722 } | 718 } |
| 723 } | 719 } |
| 724 | 720 |
| 725 #endif // WEBRTC_POSIX | 721 #endif // WEBRTC_POSIX |
| 726 | 722 |
| 727 uint32_t SocketDispatcher::GetRequestedEvents() { | 723 uint32_t SocketDispatcher::GetRequestedEvents() { |
| 728 return enabled_events_; | 724 return enabled_events_; |
| 729 } | 725 } |
| 730 | 726 |
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1597 break; | 1593 break; |
| 1598 } | 1594 } |
| 1599 } | 1595 } |
| 1600 | 1596 |
| 1601 // Done | 1597 // Done |
| 1602 return true; | 1598 return true; |
| 1603 } | 1599 } |
| 1604 #endif // WEBRTC_WIN | 1600 #endif // WEBRTC_WIN |
| 1605 | 1601 |
| 1606 } // namespace rtc | 1602 } // namespace rtc |
| OLD | NEW |