Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: remoting/host/gnubby_auth_handler_posix.cc

Issue 376323002: Refactor unix domain socket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved UnixDomainListenSocket to net::deprecated namespace. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/socket/unix_domain_socket_posix_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "remoting/host/gnubby_auth_handler_posix.h" 5 #include "remoting/host/gnubby_auth_handler_posix.h"
6 6
7 #include <unistd.h> 7 #include <unistd.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/json/json_reader.h" 12 #include "base/json/json_reader.h"
13 #include "base/json/json_writer.h" 13 #include "base/json/json_writer.h"
14 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
15 #include "base/stl_util.h" 15 #include "base/stl_util.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "net/socket/unix_domain_socket_posix.h" 17 #include "net/socket/unix_domain_listen_socket_posix.h"
18 #include "remoting/base/logging.h" 18 #include "remoting/base/logging.h"
19 #include "remoting/host/gnubby_socket.h" 19 #include "remoting/host/gnubby_socket.h"
20 #include "remoting/proto/control.pb.h" 20 #include "remoting/proto/control.pb.h"
21 #include "remoting/protocol/client_stub.h" 21 #include "remoting/protocol/client_stub.h"
22 22
23 namespace remoting { 23 namespace remoting {
24 24
25 namespace { 25 namespace {
26 26
27 const char kConnectionId[] = "connectionId"; 27 const char kConnectionId[] = "connectionId";
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 void GnubbyAuthHandlerPosix::CreateAuthorizationSocket() { 256 void GnubbyAuthHandlerPosix::CreateAuthorizationSocket() {
257 DCHECK(CalledOnValidThread()); 257 DCHECK(CalledOnValidThread());
258 258
259 if (!g_gnubby_socket_name.Get().empty()) { 259 if (!g_gnubby_socket_name.Get().empty()) {
260 // If the file already exists, a socket in use error is returned. 260 // If the file already exists, a socket in use error is returned.
261 base::DeleteFile(g_gnubby_socket_name.Get(), false); 261 base::DeleteFile(g_gnubby_socket_name.Get(), false);
262 262
263 HOST_LOG << "Listening for gnubby requests on " 263 HOST_LOG << "Listening for gnubby requests on "
264 << g_gnubby_socket_name.Get().value(); 264 << g_gnubby_socket_name.Get().value();
265 265
266 auth_socket_ = net::UnixDomainSocket::CreateAndListen( 266 auth_socket_ = net::deprecated::UnixDomainListenSocket::CreateAndListen(
267 g_gnubby_socket_name.Get().value(), this, base::Bind(MatchUid)); 267 g_gnubby_socket_name.Get().value(), this, base::Bind(MatchUid));
268 if (!auth_socket_.get()) { 268 if (!auth_socket_.get()) {
269 LOG(ERROR) << "Failed to open socket for gnubby requests"; 269 LOG(ERROR) << "Failed to open socket for gnubby requests";
270 } 270 }
271 } else { 271 } else {
272 HOST_LOG << "No gnubby socket name specified"; 272 HOST_LOG << "No gnubby socket name specified";
273 } 273 }
274 } 274 }
275 275
276 void GnubbyAuthHandlerPosix::ProcessGnubbyRequest( 276 void GnubbyAuthHandlerPosix::ProcessGnubbyRequest(
(...skipping 21 matching lines...) Expand all
298 } 298 }
299 299
300 void GnubbyAuthHandlerPosix::RequestTimedOut(int connection_id) { 300 void GnubbyAuthHandlerPosix::RequestTimedOut(int connection_id) {
301 HOST_LOG << "Gnubby request timed out"; 301 HOST_LOG << "Gnubby request timed out";
302 ActiveSockets::iterator iter = active_sockets_.find(connection_id); 302 ActiveSockets::iterator iter = active_sockets_.find(connection_id);
303 if (iter != active_sockets_.end()) 303 if (iter != active_sockets_.end())
304 SendErrorAndCloseActiveSocket(iter); 304 SendErrorAndCloseActiveSocket(iter);
305 } 305 }
306 306
307 } // namespace remoting 307 } // namespace remoting
OLDNEW
« no previous file with comments | « net/socket/unix_domain_socket_posix_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698