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

Unified Diff: webrtc/base/socketadapters.cc

Issue 1215713003: Ensuring that UDP TURN servers are always used as STUN servers. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing compiler warning from size_t->int cast Created 5 years, 5 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 | « webrtc/base/proxyserver.cc ('k') | webrtc/p2p/base/port_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/socketadapters.cc
diff --git a/webrtc/base/socketadapters.cc b/webrtc/base/socketadapters.cc
index 4a2da0adfcd800ea53519505f6ee458ad36155dd..b1c2a87aa9b2b5ac9e5d7038bb3176104fc1765b 100644
--- a/webrtc/base/socketadapters.cc
+++ b/webrtc/base/socketadapters.cc
@@ -81,10 +81,18 @@ int BufferedReadAdapter::Recv(void *pv, size_t cb) {
// FIX: If cb == 0, we won't generate another read event
int res = AsyncSocketAdapter::Recv(pv, cb);
- if (res < 0)
- return res;
+ if (res >= 0) {
+ // Read from socket and possibly buffer; return combined length
+ return res + static_cast<int>(read);
+ }
+
+ if (read > 0) {
+ // Failed to read from socket, but still read something from buffer
+ return static_cast<int>(read);
+ }
- return res + static_cast<int>(read);
+ // Didn't read anything; return error from socket
+ return res;
}
void BufferedReadAdapter::BufferInput(bool on) {
« no previous file with comments | « webrtc/base/proxyserver.cc ('k') | webrtc/p2p/base/port_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698