OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ipc/ipc_channel_posix.h" | 5 #include "ipc/ipc_channel_posix.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 | 986 |
987 // Close any outstanding, received file descriptors. | 987 // Close any outstanding, received file descriptors. |
988 for (std::vector<int>::iterator | 988 for (std::vector<int>::iterator |
989 i = input_overflow_fds_.begin(); i != input_overflow_fds_.end(); ++i) { | 989 i = input_overflow_fds_.begin(); i != input_overflow_fds_.end(); ++i) { |
990 if (HANDLE_EINTR(close(*i)) < 0) | 990 if (HANDLE_EINTR(close(*i)) < 0) |
991 PLOG(ERROR) << "close"; | 991 PLOG(ERROR) << "close"; |
992 } | 992 } |
993 input_overflow_fds_.clear(); | 993 input_overflow_fds_.clear(); |
994 } | 994 } |
995 | 995 |
| 996 // static |
| 997 bool Channel::ChannelImpl::IsNamedServerInitialized( |
| 998 const std::string& channel_id) { |
| 999 return file_util::PathExists(FilePath(channel_id)); |
| 1000 } |
| 1001 |
996 // Called by libevent when we can read from the pipe without blocking. | 1002 // Called by libevent when we can read from the pipe without blocking. |
997 void Channel::ChannelImpl::OnFileCanReadWithoutBlocking(int fd) { | 1003 void Channel::ChannelImpl::OnFileCanReadWithoutBlocking(int fd) { |
998 bool send_server_hello_msg = false; | 1004 bool send_server_hello_msg = false; |
999 if (fd == server_listen_pipe_) { | 1005 if (fd == server_listen_pipe_) { |
1000 int new_pipe = 0; | 1006 int new_pipe = 0; |
1001 if (!ServerAcceptConnection(server_listen_pipe_, &new_pipe)) { | 1007 if (!ServerAcceptConnection(server_listen_pipe_, &new_pipe)) { |
1002 Close(); | 1008 Close(); |
1003 listener_->OnChannelListenError(); | 1009 listener_->OnChannelListenError(); |
1004 } | 1010 } |
1005 | 1011 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1195 } | 1201 } |
1196 | 1202 |
1197 bool Channel::GetClientEuid(uid_t* client_euid) const { | 1203 bool Channel::GetClientEuid(uid_t* client_euid) const { |
1198 return channel_impl_->GetClientEuid(client_euid); | 1204 return channel_impl_->GetClientEuid(client_euid); |
1199 } | 1205 } |
1200 | 1206 |
1201 void Channel::ResetToAcceptingConnectionState() { | 1207 void Channel::ResetToAcceptingConnectionState() { |
1202 channel_impl_->ResetToAcceptingConnectionState(); | 1208 channel_impl_->ResetToAcceptingConnectionState(); |
1203 } | 1209 } |
1204 | 1210 |
| 1211 // static |
| 1212 bool Channel::IsNamedServerInitialized(const std::string& channel_id) { |
| 1213 return ChannelImpl::IsNamedServerInitialized(channel_id); |
| 1214 } |
| 1215 |
1205 } // namespace IPC | 1216 } // namespace IPC |
OLD | NEW |