summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2013-07-22 14:28:01 -0400
committerEric Milkie <milkie@10gen.com>2013-07-22 14:28:01 -0400
commit7ea27bae26b61e16439a36431e71d030842acd2c (patch)
tree50be5812c081325d7e712cc25352201e337a4f3d
parent0d74c378de2be46cd572417071e3685965234a5e (diff)
downloadmongo-7ea27bae26b61e16439a36431e71d030842acd2c.tar.gz
SERVER-10261 end TCP sockets cleanly
This is a partial backport of SERVER-9041's commit. In particular, this fixes an issue with SSL and the Java driver's session caching.
-rw-r--r--src/mongo/util/net/sock.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/util/net/sock.cpp b/src/mongo/util/net/sock.cpp
index 2f155c5295c..b4de0672d36 100644
--- a/src/mongo/util/net/sock.cpp
+++ b/src/mongo/util/net/sock.cpp
@@ -425,6 +425,12 @@ namespace mongo {
void Socket::close() {
if ( _fd >= 0 ) {
+ // Stop any blocking reads/writes, and prevent new reads/writes
+#if defined(_WIN32)
+ shutdown( _fd, SD_BOTH );
+#else
+ shutdown( _fd, SHUT_RDWR );
+#endif
closesocket( _fd );
_fd = -1;
}