summaryrefslogtreecommitdiff
path: root/src/mongo/util/net/sock.cpp
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2012-01-06 11:18:08 -0500
committerEric Milkie <milkie@10gen.com>2012-01-06 11:18:55 -0500
commit875440f15baec0425fda11d28bf8d08bf22cc81b (patch)
treea805a2c7e782b1a401d2901ba1edf9110b34bade /src/mongo/util/net/sock.cpp
parent4f6a5bf5909994eb75ce1d6f28587b3b2a448310 (diff)
downloadmongo-875440f15baec0425fda11d28bf8d08bf22cc81b.tar.gz
print correct error text for socket errors on Windows
Diffstat (limited to 'src/mongo/util/net/sock.cpp')
-rw-r--r--src/mongo/util/net/sock.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mongo/util/net/sock.cpp b/src/mongo/util/net/sock.cpp
index 94597bbdfdd..4b62d79023f 100644
--- a/src/mongo/util/net/sock.cpp
+++ b/src/mongo/util/net/sock.cpp
@@ -595,9 +595,11 @@ namespace mongo {
#endif
#if defined(_WIN32)
- if ( WSAGetLastError() == WSAETIMEDOUT && _timeout != 0 ) {
+ const int mongo_errno = WSAGetLastError();
+ if ( mongo_errno == WSAETIMEDOUT && _timeout != 0 ) {
#else
- if ( ( errno == EAGAIN || errno == EWOULDBLOCK ) && _timeout != 0 ) {
+ const int mongo_errno = errno;
+ if ( ( mongo_errno == EAGAIN || mongo_errno == EWOULDBLOCK ) && _timeout != 0 ) {
#endif
log(_logLevel) << "Socket " << context << " send() timed out " << _remote.toString() << endl;
throw SocketException( SocketException::SEND_TIMEOUT , remoteString() );
@@ -605,7 +607,7 @@ namespace mongo {
else {
SocketException::Type t = SocketException::SEND_ERROR;
log(_logLevel) << "Socket " << context << " send() "
- << errnoWithDescription() << ' ' << remoteString() << endl;
+ << errnoWithDescription(mongo_errno) << ' ' << remoteString() << endl;
throw SocketException( t , remoteString() );
}
}