diff options
author | dmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-20 03:08:07 +0000 |
---|---|---|
committer | dmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-20 03:08:07 +0000 |
commit | 8bf7b53697c402fe639fa59a1033ce4816fb6a04 (patch) | |
tree | 13c9184f843fc2894415fb8d4f1a299421d70de2 /ipc/ipc_channel_posix.h | |
parent | a329ecd9f56d8e7e585773154c0266e170a83569 (diff) | |
download | chromium_src-8bf7b53697c402fe639fa59a1033ce4816fb6a04.zip chromium_src-8bf7b53697c402fe639fa59a1033ce4816fb6a04.tar.gz chromium_src-8bf7b53697c402fe639fa59a1033ce4816fb6a04.tar.bz2 |
Revert 69690 - Add support for sockets that can listen and accept a connection.
These sockets allow one connection at a time, however clients can
connect and disconnect repeatedly.
These are going to be used by Cloud Print, Remoting and
Automation.
BUG=NONE
TEST=BUILD
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=69660
Review URL: http://codereview.chromium.org/5749001
TBR=dmaclach@chromium.org
Review URL: http://codereview.chromium.org/5972002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69691 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_channel_posix.h')
-rw-r--r-- | ipc/ipc_channel_posix.h | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/ipc/ipc_channel_posix.h b/ipc/ipc_channel_posix.h index ecfd41a..4ff3de1 100644 --- a/ipc/ipc_channel_posix.h +++ b/ipc/ipc_channel_posix.h @@ -40,10 +40,12 @@ namespace IPC { +// An implementation of ChannelImpl for POSIX systems that works via +// socketpairs. See the .cc file for an overview of the implementation. class Channel::ChannelImpl : public MessageLoopForIO::Watcher { public: // Mirror methods of Channel, see ipc_channel.h for description. - ChannelImpl(const IPC::ChannelHandle& channel_handle, Mode mode, + ChannelImpl(const IPC::ChannelHandle &channel_handle, Mode mode, Listener* listener); ~ChannelImpl(); bool Connect(); @@ -51,23 +53,13 @@ class Channel::ChannelImpl : public MessageLoopForIO::Watcher { void set_listener(Listener* listener) { listener_ = listener; } bool Send(Message* message); int GetClientFileDescriptor() const; - bool AcceptsConnections() const; - bool HasAcceptedConnection() const; - void ResetToAcceptingConnectionState(); private: - bool CreatePipe(const IPC::ChannelHandle& channel_handle, - bool uses_domain_sockets, - bool listening_socket); + bool CreatePipe(const IPC::ChannelHandle &channel_handle, Mode mode); bool ProcessIncomingMessages(); bool ProcessOutgoingMessages(); - bool AcceptConnection(); - void ClosePipeOnError(); - void QueueHelloMessage(); - bool IsHelloMessage(const Message* m) const; - // MessageLoopForIO::Watcher implementation. virtual void OnFileCanReadWithoutBlocking(int fd); virtual void OnFileCanWriteWithoutBlocking(int fd); @@ -82,14 +74,17 @@ class Channel::ChannelImpl : public MessageLoopForIO::Watcher { // Indicates whether we're currently blocked waiting for a write to complete. bool is_blocked_on_write_; - bool waiting_connect_; // If sending a message blocks then we use this variable // to keep track of where we are. size_t message_send_bytes_written_; - // File descriptor we're listening on for new connections if we listen - // for connections. + // If the kTestingChannelID flag is specified, we use a FIFO instead of + // a socketpair(). + bool uses_fifo_; + + // File descriptor we're listening on for new connections in the FIFO case; + // unused otherwise. int server_listen_pipe_; // The pipe used for communication. @@ -137,20 +132,16 @@ class Channel::ChannelImpl : public MessageLoopForIO::Watcher { std::string input_overflow_buf_; std::vector<int> input_overflow_fds_; - // True if we are responsible for unlinking the unix domain socket file. - bool must_unlink_; + // In server-mode, we have to wait for the client to connect before we + // can begin reading. We make use of the input_state_ when performing + // the connect operation in overlapped mode. + bool waiting_connect_; ScopedRunnableMethodFactory<ChannelImpl> factory_; DISALLOW_COPY_AND_ASSIGN(ChannelImpl); }; -// The maximum length of the name of a pipe for MODE_NAMED_SERVER or -// MODE_NAMED_CLIENT if you want to pass in your own socket. -// The standard size on linux is 108, mac is 104. To maintain consistency -// across platforms we standardize on the smaller value. -static const size_t kMaxPipeNameLength = 104; - } // namespace IPC #endif // IPC_IPC_CHANNEL_POSIX_H_ |