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

Unified Diff: ipc/ipc_channel_posix.cc

Issue 172773002: Fix posix IPC channel hanging problem, take 3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed change that is not needed anymore Created 6 years, 10 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 | « no previous file | ipc/ipc_channel_posix_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_channel_posix.cc
diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc
index 878853290016620a1276ce2707ed52b8a7fa7f9b..2bd0989ddabdc20a113f3750613853018f26b21f 100644
--- a/ipc/ipc_channel_posix.cc
+++ b/ipc/ipc_channel_posix.cc
@@ -327,7 +327,7 @@ bool Channel::ChannelImpl::CreatePipe(
bool Channel::ChannelImpl::Connect() {
if (server_listen_pipe_ == -1 && pipe_ == -1) {
- DLOG(INFO) << "Channel creation failed: " << pipe_name_;
+ DLOG(WARNING) << "Channel creation failed: " << pipe_name_;
return false;
}
@@ -464,15 +464,19 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
CloseFileDescriptors(msg);
if (bytes_written < 0 && !SocketWriteErrorIsRecoverable()) {
+ // We can't close the pipe here, because calling OnChannelError
+ // may destroy this object, and that would be bad if we are
+ // called from Send(). Instead, we return false and hope the
+ // caller will close the pipe. If they do not, the pipe will
+ // still be closed next time OnFileCanReadWithoutBlocking is
+ // called.
#if defined(OS_MACOSX)
// On OSX writing to a pipe with no listener returns EPERM.
if (errno == EPERM) {
- Close();
return false;
}
#endif // OS_MACOSX
if (errno == EPIPE) {
- Close();
return false;
}
PLOG(ERROR) << "pipe error on "
@@ -680,7 +684,7 @@ void Channel::ChannelImpl::OnFileCanReadWithoutBlocking(int fd) {
// If we're a server and handshaking, then we want to make sure that we
// only send our handshake message after we've processed the client's.
// This gives us a chance to kill the client if the incoming handshake
- // is invalid. This also flushes any closefd messagse.
+ // is invalid. This also flushes any closefd messages.
if (!is_blocked_on_write_) {
if (!ProcessOutgoingMessages()) {
ClosePipeOnError();
« no previous file with comments | « no previous file | ipc/ipc_channel_posix_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698