summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2012-11-29 13:56:25 -0500
committerDan Pasette <dan@10gen.com>2013-01-08 01:54:22 -0500
commit8885784cf186b48bda5bd0ee99ff0bfa0a76ff69 (patch)
tree7d4185a1d558de521d93ef05a74bbcfc212e8ea7
parent4473320aca6097d567cb4f3b2e48ad776dd544b1 (diff)
downloadmongo-8885784cf186b48bda5bd0ee99ff0bfa0a76ff69.tar.gz
SERVER-5487 do not call SSL_shutdown on an SSL context while another thread is using it
-rw-r--r--src/mongo/util/net/sock.cpp18
-rw-r--r--src/mongo/util/net/sock.h4
2 files changed, 12 insertions, 10 deletions
diff --git a/src/mongo/util/net/sock.cpp b/src/mongo/util/net/sock.cpp
index baaa13fbb2d..25a97e8029e 100644
--- a/src/mongo/util/net/sock.cpp
+++ b/src/mongo/util/net/sock.cpp
@@ -502,6 +502,17 @@ namespace mongo {
_timeout = timeout;
_init();
}
+
+ Socket::~Socket() {
+ close();
+#ifdef MONGO_SSL
+ if ( _ssl ) {
+ SSL_shutdown( _ssl );
+ SSL_free( _ssl );
+ _ssl = 0;
+ }
+#endif
+ }
void Socket::_init() {
_bytesOut = 0;
@@ -513,13 +524,6 @@ namespace mongo {
}
void Socket::close() {
-#ifdef MONGO_SSL
- if ( _ssl ) {
- SSL_shutdown( _ssl );
- SSL_free( _ssl );
- _ssl = 0;
- }
-#endif
if ( _fd >= 0 ) {
closesocket( _fd );
_fd = -1;
diff --git a/src/mongo/util/net/sock.h b/src/mongo/util/net/sock.h
index 436998e7a09..b9963e09f69 100644
--- a/src/mongo/util/net/sock.h
+++ b/src/mongo/util/net/sock.h
@@ -204,9 +204,7 @@ namespace mongo {
*/
Socket(double so_timeout = 0, int logLevel = 0 );
- ~Socket() {
- close();
- }
+ ~Socket();
bool connect(SockAddr& farEnd);
void close();