summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Midvidy <amidvidy@gmail.com>2014-08-11 13:45:16 -0400
committerBenety Goh <benety@mongodb.com>2014-08-11 13:50:43 -0400
commit08873e79890885f83d0a9ae1de7ea9f4769cd83d (patch)
tree692df81b94851be5763cbf2ecadb9d0906572043
parentcf2917a1e94959a696642407425f89fe14ccb1b4 (diff)
downloadmongo-08873e79890885f83d0a9ae1de7ea9f4769cd83d.tar.gz
SERVER-14165 reenable isself fastpath for OSX
Closes #736 Signed-off-by: Benety Goh <benety@mongodb.com>
-rw-r--r--src/mongo/db/repl/isself.cpp8
-rw-r--r--src/mongo/db/repl/isself_test.cpp4
2 files changed, 6 insertions, 6 deletions
diff --git a/src/mongo/db/repl/isself.cpp b/src/mongo/db/repl/isself.cpp
index 39809cbc01f..fc7eca41f34 100644
--- a/src/mongo/db/repl/isself.cpp
+++ b/src/mongo/db/repl/isself.cpp
@@ -44,7 +44,7 @@
#include "mongo/util/scopeguard.h"
#include "mongo/util/log.h"
-#ifdef __linux__
+#if defined(__linux__) || defined(__APPLE__)
#include <ifaddrs.h>
#include <netdb.h>
#elif defined(_WIN32)
@@ -56,7 +56,7 @@
#include <Ws2tcpip.h>
#endif // defined(_WIN32)
-#if defined(_WIN32) || defined(__linux__)
+#if defined(_WIN32) || defined(__linux__) || defined(__APPLE__)
#define FASTPATH 1
#endif
@@ -80,7 +80,7 @@ namespace {
* we need gai_strerror.
*/
std::string stringifyError(int code) {
-#ifdef __linux__
+#if defined(__linux__) || defined(__APPLE__)
return gai_strerror(code);
#elif defined(_WIN32)
// FormatMessage in errnoWithDescription works here on windows
@@ -221,7 +221,7 @@ namespace {
std::vector<std::string> getBoundAddrs(const bool ipv6enabled) {
#ifdef FASTPATH
std::vector<std::string> out;
-#ifdef __linux__
+#if defined(__linux__) || defined(__APPLE__)
ifaddrs* addrs;
diff --git a/src/mongo/db/repl/isself_test.cpp b/src/mongo/db/repl/isself_test.cpp
index ef1d130d112..b54f32c0b9f 100644
--- a/src/mongo/db/repl/isself_test.cpp
+++ b/src/mongo/db/repl/isself_test.cpp
@@ -41,7 +41,7 @@ namespace repl {
namespace {
TEST(IsSelf, DetectsSameHostIPv4) {
-#if defined(_WIN32) || defined(__linux__)
+#if defined(_WIN32) || defined(__linux__) || defined(__APPLE__)
bool wasEnabled = IPv6Enabled();
enableIPv6(false);
ON_BLOCK_EXIT(enableIPv6, wasEnabled);
@@ -60,7 +60,7 @@ namespace {
}
TEST(IsSelf, DetectsSameHostIPv6) {
-#if defined(_WIN32) || defined(__linux__)
+#if defined(_WIN32) || defined(__linux__) || defined(__APPLE__)
bool wasEnabled = IPv6Enabled();
enableIPv6(true);
ON_BLOCK_EXIT(enableIPv6, wasEnabled);