summaryrefslogtreecommitdiff
path: root/util/sock.h
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2010-04-05 14:11:40 -0400
committerMathias Stearn <mathias@10gen.com>2010-04-05 14:11:40 -0400
commitcaf3617fc551e4fbd545552f405c76d9b4806903 (patch)
tree81b71df001ce98a11eb6f2b67c4f3adba116f875 /util/sock.h
parent41e683a2a50ed945eae630e7ffe8f169b53f3377 (diff)
downloadmongo-caf3617fc551e4fbd545552f405c76d9b4806903.tar.gz
windows fixes
Diffstat (limited to 'util/sock.h')
-rw-r--r--util/sock.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/util/sock.h b/util/sock.h
index c41a6bf9cbd..86f9c004be6 100644
--- a/util/sock.h
+++ b/util/sock.h
@@ -49,10 +49,6 @@ namespace mongo {
char sun_path[108]; // length from unix header
};
- // Windows doesn't const-qualify src for some reason
- inline const char* inet_ntop(int af, const void* src, char* dst, socklen_t size){
- return ::inet_ntop(af, const_cast<void*>(src),dst,size);
- }
#else
} // namespace mongo
@@ -158,8 +154,13 @@ namespace mongo {
char buffer[buflen];
switch (getType()){
+#ifdef _WIN32
+ case AF_INET: return inet_ntoa(as<sockaddr_in>().sin_addr);
+ case AF_INET6: return "No IPv6 support on windows";
+#else
case AF_INET: return inet_ntop(getType(), &as<sockaddr_in>().sin_addr, buffer, addressSize);
case AF_INET6: return inet_ntop(getType(), &as<sockaddr_in6>().sin6_addr, buffer, addressSize);
+#endif
case AF_UNIX: return as<sockaddr_un>().sun_path;
case AF_UNSPEC: return "(NONE)";
default: massert(SOCK_FAMILY_UNKNOWN_ERROR, "unsupported address family", false); return "";