Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Unified Diff: webrtc/base/physicalsocketserver.cc

Issue 2678353006: Getting rid of "benign blocking error" log spam. (Closed)
Patch Set: Also handle EINTR Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/physicalsocketserver.cc
diff --git a/webrtc/base/physicalsocketserver.cc b/webrtc/base/physicalsocketserver.cc
index 6970388844e4a9475d62a38a0201108ebe43bd47..07591e8ad332b534516fdb0f27ed21c7fe9f55ec 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.
@@ -707,6 +714,11 @@ bool SocketDispatcher::IsDescriptorClosed() {
// Returned during ungraceful peer shutdown.
case ECONNRESET:
return true;
+ // The normal blocking error; don't log anything.
+ case EWOULDBLOCK:
+ // Interrupted system call.
+ case EINTR:
+ return false;
default:
// Assume that all other errors are just blocking errors, meaning the
// connection is still good but we just can't read from it right now.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698