mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
Don't convert an ip to another ip; only convert a hostname to an ip
This commit is contained in:
parent
6bb5ca74b8
commit
9a36738d0c
@ -22,9 +22,12 @@
|
||||
namespace mongo {
|
||||
|
||||
static boost::mutex sock_mutex;
|
||||
// .empty() if err
|
||||
|
||||
string hostbyname(const char *hostname) {
|
||||
boostlock lk(sock_mutex);
|
||||
struct in_addr temp;
|
||||
if ( inet_aton( hostname, &temp ) )
|
||||
return hostname;
|
||||
struct hostent *h;
|
||||
h = gethostbyname(hostname);
|
||||
if ( h == 0 ) return "";
|
||||
|
@ -96,7 +96,8 @@ namespace mongo {
|
||||
}
|
||||
}
|
||||
|
||||
// .empty() if err
|
||||
// If an ip address is passed in, just return that. If a hostname is passed
|
||||
// in, look up its ip and return that. Returns "" on failure.
|
||||
string hostbyname(const char *hostname);
|
||||
|
||||
struct SockAddr {
|
||||
|
Loading…
Reference in New Issue
Block a user