diff options
author | Mathias Stearn <mathias@10gen.com> | 2010-04-05 19:33:37 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2010-04-05 19:33:37 -0400 |
commit | 9d5da5e69092afbf9c3cc382e2754007c1828b84 (patch) | |
tree | c41a78c5cea9f02a36eb4ffbc789686b0334acf2 /client/dbclient.cpp | |
parent | 0f2e939810db49b413073c67ce1fb03ae6e1658a (diff) | |
download | mongo-9d5da5e69092afbf9c3cc382e2754007c1828b84.tar.gz |
If using localhost, try to use unix socket SERVER-866
Diffstat (limited to 'client/dbclient.cpp')
-rw-r--r-- | client/dbclient.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/client/dbclient.cpp b/client/dbclient.cpp index db6b4989abe..9bfdb385338 100644 --- a/client/dbclient.cpp +++ b/client/dbclient.cpp @@ -465,6 +465,16 @@ namespace mongo { server = auto_ptr<SockAddr>(new SockAddr(ip.c_str(), port)); p = auto_ptr<MessagingPort>(new MessagingPort()); +#ifndef _WIN32 + if (server->getAddr() == "127.0.0.1"){ + SockAddr _server (makeUnixSockPath(port).c_str(), port); + if (p->connect(_server)){ + *server = _server; + return true; + } + } +#endif + if ( !p->connect(*server) ) { stringstream ss; ss << "couldn't connect to server " << serverAddress << " " << ip << ":" << port; |