OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/socket/unix_domain_socket_posix.h" | 5 #include "net/socket/unix_domain_socket_posix.h" |
6 | 6 |
7 #include <cstring> | 7 #include <cstring> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include <errno.h> | 10 #include <errno.h> |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 if (!GetPeerIds(conn, &user_id, &group_id) || | 144 if (!GetPeerIds(conn, &user_id, &group_id) || |
145 !auth_callback_.Run(user_id, group_id)) { | 145 !auth_callback_.Run(user_id, group_id)) { |
146 if (HANDLE_EINTR(close(conn)) < 0) | 146 if (HANDLE_EINTR(close(conn)) < 0) |
147 LOG(ERROR) << "close() error"; | 147 LOG(ERROR) << "close() error"; |
148 return; | 148 return; |
149 } | 149 } |
150 scoped_refptr<UnixDomainSocket> sock( | 150 scoped_refptr<UnixDomainSocket> sock( |
151 new UnixDomainSocket(conn, socket_delegate_, auth_callback_)); | 151 new UnixDomainSocket(conn, socket_delegate_, auth_callback_)); |
152 // It's up to the delegate to AddRef if it wants to keep it around. | 152 // It's up to the delegate to AddRef if it wants to keep it around. |
153 sock->WatchSocket(WAITING_READ); | 153 sock->WatchSocket(WAITING_READ); |
154 socket_delegate_->DidAccept(this, sock); | 154 socket_delegate_->DidAccept(this, sock.get()); |
155 } | 155 } |
156 | 156 |
157 UnixDomainSocketFactory::UnixDomainSocketFactory( | 157 UnixDomainSocketFactory::UnixDomainSocketFactory( |
158 const std::string& path, | 158 const std::string& path, |
159 const UnixDomainSocket::AuthCallback& auth_callback) | 159 const UnixDomainSocket::AuthCallback& auth_callback) |
160 : path_(path), | 160 : path_(path), |
161 auth_callback_(auth_callback) {} | 161 auth_callback_(auth_callback) {} |
162 | 162 |
163 UnixDomainSocketFactory::~UnixDomainSocketFactory() {} | 163 UnixDomainSocketFactory::~UnixDomainSocketFactory() {} |
164 | 164 |
(...skipping 19 matching lines...) Expand all Loading... |
184 scoped_refptr<StreamListenSocket> | 184 scoped_refptr<StreamListenSocket> |
185 UnixDomainSocketWithAbstractNamespaceFactory::CreateAndListen( | 185 UnixDomainSocketWithAbstractNamespaceFactory::CreateAndListen( |
186 StreamListenSocket::Delegate* delegate) const { | 186 StreamListenSocket::Delegate* delegate) const { |
187 return UnixDomainSocket::CreateAndListenWithAbstractNamespace( | 187 return UnixDomainSocket::CreateAndListenWithAbstractNamespace( |
188 path_, fallback_path_, delegate, auth_callback_); | 188 path_, fallback_path_, delegate, auth_callback_); |
189 } | 189 } |
190 | 190 |
191 #endif | 191 #endif |
192 | 192 |
193 } // namespace net | 193 } // namespace net |
OLD | NEW |