diff options
author | cmasone <cmasone@chromium.org> | 2014-09-03 11:11:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-03 18:15:42 +0000 |
commit | ca100d5970b0d0b9a3af96d180f5ea2862227a48 (patch) | |
tree | 74624fc2b0db4ab0a5cc05a89fa4d6d73e9f3a74 /net/socket/unix_domain_server_socket_posix.h | |
parent | 292bdba734f35d78a045b3cccf8c31fa6e4f4fce (diff) | |
download | chromium_src-ca100d5970b0d0b9a3af96d180f5ea2862227a48.zip chromium_src-ca100d5970b0d0b9a3af96d180f5ea2862227a48.tar.gz chromium_src-ca100d5970b0d0b9a3af96d180f5ea2862227a48.tar.bz2 |
Raw SocketDescriptor variant of UnixDomainServerSocket::Accept
The Mojo code on CrOS needs to accept inbound connections
on a unix domain socket, and then 'promote' the resulting
sockets to Mojo MessagePipes. This really requires access
to the underying file descriptor, so provide a mechanism
to accept a connection and get back a SocketDescriptor.
BUG=407782
TEST=UnixDomain*SocketTest
R=mmenke@chromium.org
Review URL: https://codereview.chromium.org/509133002
Cr-Commit-Position: refs/heads/master@{#293172}
Diffstat (limited to 'net/socket/unix_domain_server_socket_posix.h')
-rw-r--r-- | net/socket/unix_domain_server_socket_posix.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/net/socket/unix_domain_server_socket_posix.h b/net/socket/unix_domain_server_socket_posix.h index 85c743d..65b3fa1 100644 --- a/net/socket/unix_domain_server_socket_posix.h +++ b/net/socket/unix_domain_server_socket_posix.h @@ -59,11 +59,23 @@ class NET_EXPORT UnixDomainServerSocket : public ServerSocket { virtual int Accept(scoped_ptr<StreamSocket>* socket, const CompletionCallback& callback) OVERRIDE; + // Accepts an incoming connection on |listen_socket_|, but passes back + // a raw SocketDescriptor instead of a StreamSocket. + int AcceptSocketDescriptor(SocketDescriptor* socket_descriptor, + const CompletionCallback& callback); + private: - void AcceptCompleted(scoped_ptr<StreamSocket>* socket, + // A callback to wrap the setting of the out-parameter to Accept(). + // This allows the internal machinery of that call to be implemented in + // a manner that's agnostic to the caller's desired output. + typedef base::Callback<void(scoped_ptr<SocketLibevent>)> SetterCallback; + + int DoAccept(const SetterCallback& setter_callback, + const CompletionCallback& callback); + void AcceptCompleted(const SetterCallback& setter_callback, const CompletionCallback& callback, int rv); - bool AuthenticateAndGetStreamSocket(scoped_ptr<StreamSocket>* socket); + bool AuthenticateAndGetStreamSocket(const SetterCallback& setter_callback); scoped_ptr<SocketLibevent> listen_socket_; const AuthCallback auth_callback_; |