Chromium Code Reviews| Index: ipc/ipc_channel_posix.cc |
| diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc |
| index 878853290016620a1276ce2707ed52b8a7fa7f9b..c407b78cddcc385b9ccc5e39cfbfedb2b16ef916 100644 |
| --- a/ipc/ipc_channel_posix.cc |
| +++ b/ipc/ipc_channel_posix.cc |
| @@ -31,6 +31,7 @@ |
| #include "base/posix/global_descriptors.h" |
| #include "base/process/process_handle.h" |
| #include "base/rand_util.h" |
| +#include "base/run_loop.h" |
| #include "base/stl_util.h" |
| #include "base/strings/string_util.h" |
| #include "base/synchronization/lock.h" |
| @@ -327,7 +328,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; |
| } |
| @@ -515,6 +516,11 @@ bool Channel::ChannelImpl::Send(Message* message) { |
| << " with type " << message->type() |
| << " (" << output_queue_.size() << " in queue)"; |
| + if (!waiting_connect_ && pipe_ == -1) { |
| + delete message; |
| + return false; |
| + } |
| + |
| #ifdef IPC_MESSAGE_LOG_ENABLED |
| Logging::GetInstance()->OnSendMessage(message, ""); |
| #endif // IPC_MESSAGE_LOG_ENABLED |
|
Scott Hess - ex-Googler
2014/02/03 22:00:26
Is there any problem having this above the above c
hubbe
2014/02/04 19:13:38
No problem - done.
On 2014/02/03 22:00:26, shess
|
| @@ -522,7 +528,10 @@ bool Channel::ChannelImpl::Send(Message* message) { |
| message->TraceMessageBegin(); |
| output_queue_.push(message); |
| if (!is_blocked_on_write_ && !waiting_connect_) { |
| - return ProcessOutgoingMessages(); |
| + if (!ProcessOutgoingMessages()) { |
| + ClosePipeOnError(); |
| + return false; |
| + } |
| } |
| return true; |
| @@ -707,7 +716,11 @@ bool Channel::ChannelImpl::AcceptConnection() { |
| // In server mode we will send a hello message when we receive one from a |
| // client. |
| waiting_connect_ = false; |
| - return ProcessOutgoingMessages(); |
| + if (!ProcessOutgoingMessages()) { |
| + ClosePipeOnError(); |
| + return false; |
| + } |
| + return true; |
| } else if (mode_ & MODE_SERVER_FLAG) { |
| waiting_connect_ = true; |
| return true; |