0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

IPv6 support for HostAndPort SERVER-1114

This commit is contained in:
Mathias Stearn 2010-05-13 17:20:12 -04:00
parent d0aa6b1cb1
commit d429288723

View File

@ -40,7 +40,7 @@ namespace mongo {
static HostAndPort fromString(string s) {
const char *p = s.c_str();
uassert(13110, "HostAndPort: bad config string", *p);
const char *colon = strchr(p, ':');
const char *colon = strrchr(p, ':');
HostAndPort m;
if( colon ) {
int port = atoi(colon+1);
@ -98,7 +98,7 @@ namespace mongo {
}
inline bool HostAndPort::isLocalHost() const {
return _host == "localhost" || _host == "127.0.0.1";
return _host == "localhost" || _host == "127.0.0.1" || _host == "::1";
}
}