summaryrefslogtreecommitdiff
path: root/util/sock.h
diff options
context:
space:
mode:
authordwight <dwight@10gen.com>2010-06-27 12:10:55 -0400
committerdwight <dwight@10gen.com>2010-06-27 12:10:55 -0400
commit3f6148b89aa16a5a41b9fac3278d93d35a35c347 (patch)
tree34814b5ae54de0399968f1a305aae3e1b2dc26da /util/sock.h
parentfd7be9ee41f276055923c352738f28aec0cc813e (diff)
downloadmongo-3f6148b89aa16a5a41b9fac3278d93d35a35c347.tar.gz
solaris no rcvtimo option; use less macros
Diffstat (limited to 'util/sock.h')
-rw-r--r--util/sock.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/util/sock.h b/util/sock.h
index 55950f82d15..11948fad29d 100644
--- a/util/sock.h
+++ b/util/sock.h
@@ -24,10 +24,10 @@
#include "goodies.h"
#include "../db/jsobj.h"
-#define SOCK_FAMILY_UNKNOWN_ERROR 13078
-
namespace mongo {
+ const int SOCK_FAMILY_UNKNOWN_ERROR=13078;
+
#if defined(_WIN32)
typedef short sa_family_t;
@@ -119,10 +119,12 @@ namespace mongo {
struct timeval tv;
tv.tv_sec = secs;
tv.tv_usec = 0;
- massert( 13083, "unable to set SO_RCVTIMEO",
- setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *) &tv, sizeof(tv) ) == 0 );
- massert( 13084, "unable to set SO_SNDTIMEO",
- setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *) &tv, sizeof(tv) ) == 0 );
+ bool report = logLevel > 3; // solaris doesn't provide these
+ DEV report = true;
+ bool ok = setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *) &tv, sizeof(tv) ) == 0;
+ if( report && !ok ) log() << "unabled to set SO_RCVTIMEO" << endl;
+ ok = setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *) &tv, sizeof(tv) ) == 0;
+ DEV if( report && !ok ) log() << "unabled to set SO_RCVTIMEO" << endl;
}
// If an ip address is passed in, just return that. If a hostname is passed
@@ -289,6 +291,4 @@ namespace mongo {
static ListeningSockets* _instance;
};
-#undef SOCK_FAMILY_UNKNOWN_ERROR
-
} // namespace mongo