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

Unified Diff: net/socket/unix_domain_socket_posix.cc

Issue 16093005: [Android] Use a "unique" remote debugging socket name on bind failure (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Always use socket names from MakeSocketPath Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/unix_domain_socket_posix.h ('k') | net/socket/unix_domain_socket_posix_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/unix_domain_socket_posix.cc
diff --git a/net/socket/unix_domain_socket_posix.cc b/net/socket/unix_domain_socket_posix.cc
index 3f65b08bee3d18e8a32eace097014683ef7ece91..4eb7261c8c179600b9ede705c210bb7107226f41 100644
--- a/net/socket/unix_domain_socket_posix.cc
+++ b/net/socket/unix_domain_socket_posix.cc
@@ -55,10 +55,13 @@ UnixDomainSocket::AuthCallback NoAuthentication() {
// static
UnixDomainSocket* UnixDomainSocket::CreateAndListenInternal(
const std::string& path,
+ const std::string& fallback_path,
StreamListenSocket::Delegate* del,
const AuthCallback& auth_callback,
bool use_abstract_namespace) {
SocketDescriptor s = CreateAndBind(path, use_abstract_namespace);
+ if (s == kInvalidSocket && !fallback_path.empty())
+ s = CreateAndBind(fallback_path, use_abstract_namespace);
if (s == kInvalidSocket)
return NULL;
UnixDomainSocket* sock = new UnixDomainSocket(s, del, auth_callback);
@@ -71,7 +74,7 @@ scoped_refptr<UnixDomainSocket> UnixDomainSocket::CreateAndListen(
const std::string& path,
StreamListenSocket::Delegate* del,
const AuthCallback& auth_callback) {
- return CreateAndListenInternal(path, del, auth_callback, false);
+ return CreateAndListenInternal(path, "", del, auth_callback, false);
}
#if defined(SOCKET_ABSTRACT_NAMESPACE_SUPPORTED)
@@ -79,10 +82,11 @@ scoped_refptr<UnixDomainSocket> UnixDomainSocket::CreateAndListen(
scoped_refptr<UnixDomainSocket>
UnixDomainSocket::CreateAndListenWithAbstractNamespace(
const std::string& path,
+ const std::string& fallback_path,
StreamListenSocket::Delegate* del,
const AuthCallback& auth_callback) {
return make_scoped_refptr(
- CreateAndListenInternal(path, del, auth_callback, true));
+ CreateAndListenInternal(path, fallback_path, del, auth_callback, true));
}
#endif
@@ -160,7 +164,8 @@ UnixDomainSocketFactory::~UnixDomainSocketFactory() {}
scoped_refptr<StreamListenSocket> UnixDomainSocketFactory::CreateAndListen(
StreamListenSocket::Delegate* delegate) const {
- return UnixDomainSocket::CreateAndListen(path_, delegate, auth_callback_);
+ return UnixDomainSocket::CreateAndListen(
+ path_, delegate, auth_callback_);
}
#if defined(SOCKET_ABSTRACT_NAMESPACE_SUPPORTED)
@@ -168,8 +173,10 @@ scoped_refptr<StreamListenSocket> UnixDomainSocketFactory::CreateAndListen(
UnixDomainSocketWithAbstractNamespaceFactory::
UnixDomainSocketWithAbstractNamespaceFactory(
const std::string& path,
+ const std::string& fallback_path,
const UnixDomainSocket::AuthCallback& auth_callback)
- : UnixDomainSocketFactory(path, auth_callback) {}
+ : UnixDomainSocketFactory(path, auth_callback),
+ fallback_path_(fallback_path) {}
UnixDomainSocketWithAbstractNamespaceFactory::
~UnixDomainSocketWithAbstractNamespaceFactory() {}
@@ -178,7 +185,7 @@ scoped_refptr<StreamListenSocket>
UnixDomainSocketWithAbstractNamespaceFactory::CreateAndListen(
StreamListenSocket::Delegate* delegate) const {
return UnixDomainSocket::CreateAndListenWithAbstractNamespace(
- path_, delegate, auth_callback_);
+ path_, fallback_path_, delegate, auth_callback_);
}
#endif
« no previous file with comments | « net/socket/unix_domain_socket_posix.h ('k') | net/socket/unix_domain_socket_posix_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698