Index: remoting/protocol/message_reader.cc |
diff --git a/remoting/protocol/message_reader.cc b/remoting/protocol/message_reader.cc |
index 02dc99792626db5dba362f006509267d696a769b..9e2d63489a6b96e6f1e0572352d1d4179c7b3921 100644 |
--- a/remoting/protocol/message_reader.cc |
+++ b/remoting/protocol/message_reader.cc |
@@ -66,14 +66,14 @@ void MessageReader::HandleReadResult(int result) { |
if (result > 0) { |
OnDataReceived(read_buffer_, result); |
+ } else if (result == net::ERR_IO_PENDING) { |
+ read_pending_ = true; |
} else { |
- if (result == net::ERR_CONNECTION_CLOSED) { |
- closed_ = true; |
- } else if (result == net::ERR_IO_PENDING) { |
- read_pending_ = true; |
- } else { |
+ if (result != net::ERR_CONNECTION_CLOSED) { |
LOG(ERROR) << "Read() returned error " << result; |
} |
+ // Stop reading after an error. |
Wez
2012/07/14 00:58:34
nit: an -> any
Sergey Ulanov
2012/07/14 01:17:22
Done.
|
+ closed_ = true; |
} |
} |
@@ -115,6 +115,7 @@ void MessageReader::ProcessDoneEvent() { |
pending_messages_--; |
DCHECK_GE(pending_messages_, 0); |
+ if (!read_pending_) |
DoRead(); // Start next read if neccessary. |
Wez
2012/07/14 00:58:34
Indentation.
Sergey Ulanov
2012/07/14 01:17:22
Done.
|
} |