diff options
author | Mathias Stearn <mathias@10gen.com> | 2013-10-09 13:46:43 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2013-10-10 14:52:36 -0400 |
commit | 3b33315ab3dedf8314eb3da126dd0fc56555deb9 (patch) | |
tree | 0214107a85d4849ddff878721f42a87a204883c4 /src/mongo/util/net/sock.cpp | |
parent | dbae94b4a6a83ad32817038259f1d2d6ac5314f1 (diff) | |
download | mongo-3b33315ab3dedf8314eb3da126dd0fc56555deb9.tar.gz |
SERVER-9929 Pull in WSAPoll from dll on windows
It is only available in Vista+
This commit also reverts f3ebed0f3ab8e1cf0df752fb9e44875ed1e3849d to reenable
jstests/sharding/shard_kill_and_pooling.js
Diffstat (limited to 'src/mongo/util/net/sock.cpp')
-rw-r--r-- | src/mongo/util/net/sock.cpp | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/src/mongo/util/net/sock.cpp b/src/mongo/util/net/sock.cpp index 327296257d2..3c182be9110 100644 --- a/src/mongo/util/net/sock.cpp +++ b/src/mongo/util/net/sock.cpp @@ -20,7 +20,6 @@ #include "mongo/util/net/sock.h" #if !defined(_WIN32) -# include <sys/poll.h> # include <sys/socket.h> # include <sys/types.h> # include <sys/un.h> @@ -40,6 +39,7 @@ #include "mongo/util/mongoutils/str.h" #include "mongo/util/net/message.h" #include "mongo/util/net/ssl_manager.h" +#include "mongo/util/net/socket_poll.h" namespace mongo { MONGO_FP_DECLARE(throwSockExcep); @@ -791,16 +791,6 @@ namespace mongo { // -1 : never check const int Socket::errorPollIntervalSecs( 5 ); -#if defined(NTDDI_VERSION) && ( !defined(NTDDI_VISTA) || ( NTDDI_VERSION < NTDDI_VISTA ) ) - // Windows XP - - // pre-Vista windows doesn't have WSAPoll, so don't test connections - bool Socket::isStillConnected() { - return true; - } - -#else // Not Windows XP - // Patch to allow better tolerance of flaky network connections that get broken // while we aren't looking. // TODO: Remove when better async changes come. @@ -810,6 +800,7 @@ namespace mongo { bool Socket::isStillConnected() { if ( errorPollIntervalSecs < 0 ) return true; + if ( ! isPollSupported() ) return true; // nothing we can do time_t now = time( 0 ); time_t idleTimeSecs = now - _lastValidityCheckAtSecs; @@ -827,11 +818,7 @@ namespace mongo { pollInfo.events = POLLIN; // Poll( info[], size, timeout ) - timeout == 0 => nonblocking -#if defined(_WIN32) - int nEvents = WSAPoll( &pollInfo, 1, 0 ); -#else - int nEvents = ::poll( &pollInfo, 1, 0 ); -#endif + int nEvents = socketPoll( &pollInfo, 1, 0 ); LOG( 2 ) << "polling for status of connection to " << remoteString() << ", " << ( nEvents == 0 ? "no events" : @@ -924,8 +911,6 @@ namespace mongo { return false; } -#endif // End Not Windows XP - #if defined(_WIN32) struct WinsockInit { WinsockInit() { |