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

Unified Diff: remoting/protocol/fake_session.cc

Issue 10703159: Fix MessageReader to handle errors properly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « remoting/protocol/fake_session.h ('k') | remoting/protocol/message_reader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/fake_session.cc
diff --git a/remoting/protocol/fake_session.cc b/remoting/protocol/fake_session.cc
index a6a3aca4f738742df398ee69c05a80fd1dd26f0a..de6f7cf8119bd666c8378f3e0897dedce7e0b123 100644
--- a/remoting/protocol/fake_session.cc
+++ b/remoting/protocol/fake_session.cc
@@ -18,7 +18,8 @@ namespace protocol {
const char kTestJid[] = "host1@gmail.com/chromoting123";
FakeSocket::FakeSocket()
- : read_pending_(false),
+ : next_read_error_(net::OK),
+ read_pending_(false),
read_buffer_size_(0),
input_pos_(0),
message_loop_(MessageLoop::current()),
@@ -55,6 +56,13 @@ void FakeSocket::PairWith(FakeSocket* peer_socket) {
int FakeSocket::Read(net::IOBuffer* buf, int buf_len,
const net::CompletionCallback& callback) {
EXPECT_EQ(message_loop_, MessageLoop::current());
+
+ if (next_read_error_ != net::OK) {
+ int r = next_read_error_;
+ next_read_error_ = net::OK;
+ return r;
+ }
+
if (input_pos_ < static_cast<int>(input_data_.size())) {
int result = std::min(buf_len,
static_cast<int>(input_data_.size()) - input_pos_);
« no previous file with comments | « remoting/protocol/fake_session.h ('k') | remoting/protocol/message_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698