Chromium Code Reviews| Index: webrtc/base/physicalsocketserver.cc |
| diff --git a/webrtc/base/physicalsocketserver.cc b/webrtc/base/physicalsocketserver.cc |
| index 6970388844e4a9475d62a38a0201108ebe43bd47..ad401f7ceb86ab123bb43045dc6c4602591c1c76 100644 |
| --- a/webrtc/base/physicalsocketserver.cc |
| +++ b/webrtc/base/physicalsocketserver.cc |
| @@ -689,6 +689,13 @@ int SocketDispatcher::GetDescriptor() { |
| } |
| bool SocketDispatcher::IsDescriptorClosed() { |
| + if (udp_) { |
| + // The MSG_PEEK trick doesn't work for UDP, since (at least in some |
| + // circumstances) it requires reading an entire UDP packet, which would be |
| + // bad for performance here. So, just check whether |s_| has been closed, |
| + // which should be sufficient. |
| + return s_ == INVALID_SOCKET; |
| + } |
| // We don't have a reliable way of distinguishing end-of-stream |
| // from readability. So test on each readable call. Is this |
| // inefficient? Probably. |
| @@ -706,6 +713,8 @@ bool SocketDispatcher::IsDescriptorClosed() { |
| case EBADF: |
| // Returned during ungraceful peer shutdown. |
| case ECONNRESET: |
| + // The normal blocking error. |
| + case EWOULDBLOCK: |
| return true; |
|
nisse-webrtc
2017/02/09 09:29:54
Return value should be true for EBADF and ECONNRES
Taylor Brandstetter
2017/02/09 10:21:43
Oops, fixed.
|
| default: |
| // Assume that all other errors are just blocking errors, meaning the |