diff options
author | Bernard Gorman <bernard.gorman@gmail.com> | 2017-06-22 22:42:58 +0100 |
---|---|---|
committer | Bernard Gorman <bernard.gorman@gmail.com> | 2017-06-23 09:44:05 +0100 |
commit | cd37a0187a9559154bc9832e8fd559238e27905d (patch) | |
tree | 5be8c15e1174c8a1e83f07ddaa3e5268fd8d0a1e /src/mongo/util/net/sock.cpp | |
parent | 97f6f450da184d0751be65062a5f80259a0c2afe (diff) | |
download | mongo-cd37a0187a9559154bc9832e8fd559238e27905d.tar.gz |
SERVER-28978 Add hostname to $collStats output, and include shard name when run on a cluster
Diffstat (limited to 'src/mongo/util/net/sock.cpp')
-rw-r--r-- | src/mongo/util/net/sock.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mongo/util/net/sock.cpp b/src/mongo/util/net/sock.cpp index dcc9b371892..1efc692229b 100644 --- a/src/mongo/util/net/sock.cpp +++ b/src/mongo/util/net/sock.cpp @@ -244,12 +244,14 @@ string getHostNameCached() { return temp; } +string getHostNameCachedAndPort() { + return str::stream() << getHostNameCached() << ':' << serverGlobalParams.port; +} + string prettyHostName() { - StringBuilder s; - s << getHostNameCached(); - if (serverGlobalParams.port != ServerGlobalParams::DefaultDBPort) - s << ':' << mongo::serverGlobalParams.port; - return s.str(); + return (serverGlobalParams.port == ServerGlobalParams::DefaultDBPort + ? getHostNameCached() + : getHostNameCachedAndPort()); } #ifdef MSG_NOSIGNAL |