0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 09:06:21 +01:00

use SO_KEEPALIVE SERVER-1126

This commit is contained in:
Eliot Horowitz 2010-05-16 21:55:48 -04:00
parent 494b178b95
commit 77459bc8a8

View File

@ -42,6 +42,8 @@ namespace mongo {
int x = 1;
if ( setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *) &x, sizeof(x)) )
out() << "ERROR: disableNagle failed" << endl;
if ( setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (char *) &x, sizeof(x)) )
out() << "ERROR: SO_KEEPALIVE failed" << endl;
}
inline void prebindOptions( int sock ) {
}
@ -84,7 +86,12 @@ namespace mongo {
#endif
if ( setsockopt(sock, level, TCP_NODELAY, (char *) &x, sizeof(x)) )
log() << "ERROR: disableNagle failed" << endl;
log() << "ERROR: disableNagle failed: " << errnoWithDescription() << endl;
#ifdef SO_KEEPALIVE
if ( setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (char *) &x, sizeof(x)) )
log() << "ERROR: SO_KEEPALIVE failed: " << errnoWithDescription() << endl;
#endif
}
inline void prebindOptions( int sock ) {