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

Unified Diff: mojo/services/network/tcp_connected_socket_impl.cc

Issue 858093002: Update the network service from the Mojo repo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « mojo/services/network/network_service_impl.cc ('k') | mojo/services/network/udp_socket_apptest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/network/tcp_connected_socket_impl.cc
diff --git a/mojo/services/network/tcp_connected_socket_impl.cc b/mojo/services/network/tcp_connected_socket_impl.cc
index ecd174c6e5bdbe2d71686549e96859f97d5ebfdd..9e8a9a9703e406881f185bb2e5725b86e15d7f40 100644
--- a/mojo/services/network/tcp_connected_socket_impl.cc
+++ b/mojo/services/network/tcp_connected_socket_impl.cc
@@ -40,10 +40,18 @@ void TCPConnectedSocketImpl::ReceiveMore() {
base::Bind(&TCPConnectedSocketImpl::OnReceiveStreamReady,
weak_ptr_factory_.GetWeakPtr()));
return;
- } else if (result != MOJO_RESULT_OK) {
+ }
+
+ if (result == MOJO_RESULT_FAILED_PRECONDITION) {
+ // It's valid that the user of this class consumed the data they care about
+ // and closed their data pipe handles after writing data. This class should
+ // still write out all the data.
+ return;
+ }
+
+ if (result != MOJO_RESULT_OK) {
// The receive stream is in a bad state.
// TODO(darin): How should this be communicated to our client?
- socket_->Close();
return;
}
@@ -63,7 +71,6 @@ void TCPConnectedSocketImpl::ReceiveMore() {
} else {
// Some kind of error.
// TODO(brettw) notify caller of error.
- socket_->Close();
}
}
@@ -78,7 +85,6 @@ void TCPConnectedSocketImpl::DidReceive(bool completed_synchronously,
// Error.
pending_receive_ = NULL; // Closes the pipe (owned by the pending write).
// TODO(brettw) notify the caller of an error?
- socket_->Close();
return;
}
@@ -111,7 +117,6 @@ void TCPConnectedSocketImpl::SendMore() {
return;
} else if (result != MOJO_RESULT_OK) {
// TODO(brettw) notify caller of error.
- socket_->Close();
return;
}
@@ -140,7 +145,6 @@ void TCPConnectedSocketImpl::DidSend(bool completed_synchronously,
if (result < 0) {
// TODO(brettw) report error.
pending_send_ = NULL;
- socket_->Close();
return;
}
« no previous file with comments | « mojo/services/network/network_service_impl.cc ('k') | mojo/services/network/udp_socket_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698