summaryrefslogtreecommitdiff
path: root/src/mongo/util/net/sock.cpp
diff options
context:
space:
mode:
authorAndreas Nilsson <andreas.nilsson@10gen.com>2013-09-24 13:55:21 -0400
committerAndreas Nilsson <andreas.nilsson@10gen.com>2013-09-24 13:55:21 -0400
commit52cf8ca8e15295690a21d9442cbd7d066651fc62 (patch)
tree4de82e4cb2024d06ce86838c70d51477132dd92b /src/mongo/util/net/sock.cpp
parent947864ed70551afa8fea409e566c6de4e062263f (diff)
downloadmongo-52cf8ca8e15295690a21d9442cbd7d066651fc62.tar.gz
SERVER-10838 Fixed stability issues with multiple SSL connections
Diffstat (limited to 'src/mongo/util/net/sock.cpp')
-rw-r--r--src/mongo/util/net/sock.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mongo/util/net/sock.cpp b/src/mongo/util/net/sock.cpp
index 754ffcd1be8..a50e8bb3efd 100644
--- a/src/mongo/util/net/sock.cpp
+++ b/src/mongo/util/net/sock.cpp
@@ -34,10 +34,6 @@
# endif
#endif
-#ifdef MONGO_SSL
-#include "mongo/util/net/ssl_manager.h"
-#endif
-
#include "mongo/util/background.h"
#include "mongo/util/concurrency/value.h"
#include "mongo/util/fail_point_service.h"
@@ -428,11 +424,6 @@ namespace mongo {
Socket::~Socket() {
close();
-#ifdef MONGO_SSL
- if (_sslConnection.get()) {
- _sslManager->SSL_shutdown( _sslConnection.get() );
- }
-#endif
}
void Socket::_init() {
@@ -446,6 +437,15 @@ namespace mongo {
void Socket::close() {
if ( _fd >= 0 ) {
+#ifdef MONGO_SSL
+ if (_sslConnection.get()) {
+ try {
+ _sslManager->SSL_shutdown( _sslConnection.get() );
+ }
+ catch (const SocketException& se) { // SSL_shutdown may throw if the connection fails
+ }
+ }
+#endif
// Stop any blocking reads/writes, and prevent new reads/writes
#if defined(_WIN32)
shutdown( _fd, SD_BOTH );