Chromium Code Reviews| Index: sandbox/linux/syscall_broker/broker_host.cc |
| diff --git a/sandbox/linux/syscall_broker/broker_host.cc b/sandbox/linux/syscall_broker/broker_host.cc |
| index 995641d6dcc2c4b6335f98bfb540d242016bdcbf..0e429658eb455f153e2c9df446d8b5d233cd21a7 100644 |
| --- a/sandbox/linux/syscall_broker/broker_host.cc |
| +++ b/sandbox/linux/syscall_broker/broker_host.cc |
| @@ -165,7 +165,7 @@ BrokerHost::~BrokerHost() { |
| // A request should have a file descriptor attached on which we will reply and |
| // that we will then close. |
| // A request should start with an int that will be used as the command type. |
| -bool BrokerHost::HandleRequest() const { |
| +BrokerHost::RequestStatus BrokerHost::HandleRequest() const { |
| ScopedVector<base::ScopedFD> fds; |
| char buf[kMaxMessageLength]; |
| errno = 0; |
| @@ -175,7 +175,7 @@ bool BrokerHost::HandleRequest() const { |
| if (msg_len == 0 || (msg_len == -1 && errno == ECONNRESET)) { |
| // EOF from the client, or the client died, we should die. |
| // TODO(jln): change this. |
|
mdempsky
2014/11/04 00:03:12
Is this TODONE?
jln (very slow on Chromium)
2014/11/04 00:12:52
Done.
|
| - _exit(0); |
| + return RequestStatus::LOST_CLIENT; |
| } |
| // The client should send exactly one file descriptor, on which we |
| @@ -183,7 +183,7 @@ bool BrokerHost::HandleRequest() const { |
| // TODO(mdempsky): ScopedVector doesn't have 'at()', only 'operator[]'. |
| if (msg_len < 0 || fds.size() != 1 || fds[0]->get() < 0) { |
| PLOG(ERROR) << "Error reading message from the client"; |
| - return false; |
| + return RequestStatus::FAILURE; |
| } |
| base::ScopedFD temporary_ipc(fds[0]->Pass()); |
| @@ -192,28 +192,32 @@ bool BrokerHost::HandleRequest() const { |
| PickleIterator iter(pickle); |
| int command_type; |
| if (pickle.ReadInt(&iter, &command_type)) { |
| - bool r = false; |
| + bool command_handled = false; |
| // Go through all the possible IPC messages. |
| switch (command_type) { |
| case COMMAND_ACCESS: |
| case COMMAND_OPEN: |
| // We reply on the file descriptor sent to us via the IPC channel. |
| - r = HandleRemoteCommand(broker_policy_, |
| - static_cast<IPCCommand>(command_type), |
| - temporary_ipc.get(), |
| - pickle, |
| - iter); |
| + command_handled = HandleRemoteCommand( |
| + broker_policy_, static_cast<IPCCommand>(command_type), |
| + temporary_ipc.get(), pickle, iter); |
| break; |
| default: |
| NOTREACHED(); |
| - r = false; |
| break; |
| } |
| - return r; |
| + |
| + if (command_handled) { |
| + return RequestStatus::SUCCESS; |
| + } else { |
| + return RequestStatus::FAILURE; |
| + } |
| + |
| + NOTREACHED(); |
| } |
| LOG(ERROR) << "Error parsing IPC request"; |
| - return false; |
| + return RequestStatus::FAILURE; |
| } |
| } // namespace syscall_broker |