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

Unified Diff: remoting/protocol/fake_stream_socket.cc

Issue 2757723002: Update ICE protocol to handle closed channel (Closed)
Patch Set: . Created 3 years, 9 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_stream_socket.h ('k') | remoting/protocol/ice_connection_to_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/fake_stream_socket.cc
diff --git a/remoting/protocol/fake_stream_socket.cc b/remoting/protocol/fake_stream_socket.cc
index b3a21f8c904003fc327a903477b23b740eccca49..3ab275fe56d805be351131db87503fbe1f9fa76c 100644
--- a/remoting/protocol/fake_stream_socket.cc
+++ b/remoting/protocol/fake_stream_socket.cc
@@ -26,7 +26,7 @@ FakeStreamSocket::~FakeStreamSocket() {
EXPECT_TRUE(task_runner_->BelongsToCurrentThread());
if (peer_socket_) {
task_runner_->PostTask(
- FROM_HERE, base::Bind(&FakeStreamSocket::AppendReadError, peer_socket_,
+ FROM_HERE, base::Bind(&FakeStreamSocket::SetReadError, peer_socket_,
net::ERR_CONNECTION_CLOSED));
}
}
@@ -48,7 +48,7 @@ void FakeStreamSocket::AppendInputData(const std::string& data) {
}
}
-void FakeStreamSocket::AppendReadError(int error) {
+void FakeStreamSocket::SetReadError(int error) {
EXPECT_TRUE(task_runner_->BelongsToCurrentThread());
// Complete pending read if any.
if (!read_callback_.is_null()) {
@@ -79,9 +79,9 @@ int FakeStreamSocket::Read(const scoped_refptr<net::IOBuffer>& buf,
memcpy(buf->data(), &(*input_data_.begin()) + input_pos_, result);
input_pos_ += result;
return result;
- } else if (next_read_error_ != net::OK) {
- int r = next_read_error_;
- next_read_error_ = net::OK;
+ } else if (next_read_error_.has_value()) {
+ int r = next_read_error_.value();
+ next_read_error_.reset();
return r;
} else {
read_buffer_ = buf;
« no previous file with comments | « remoting/protocol/fake_stream_socket.h ('k') | remoting/protocol/ice_connection_to_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698