summaryrefslogtreecommitdiff
path: root/src/mongo/util/background.cpp
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2013-01-24 12:32:54 -0500
committerEric Milkie <milkie@10gen.com>2013-01-24 12:33:36 -0500
commite599e186e2482dc2a1caf86f40e80ebb7b3de5f6 (patch)
tree0caf20252f2af88889be9c64f2ee390e82346cb1 /src/mongo/util/background.cpp
parent358794215a51f3dc8b646ad22eaad6f5e4444c5d (diff)
downloadmongo-e599e186e2482dc2a1caf86f40e80ebb7b3de5f6.tar.gz
SERVER-6656 prevent SSL memory leaks
If a BackgroundTask should attempt to use SSL (via an outbound connection), this commit will now ensure the SSL thread-specific data is cleaned up on thread exit.
Diffstat (limited to 'src/mongo/util/background.cpp')
-rw-r--r--src/mongo/util/background.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/mongo/util/background.cpp b/src/mongo/util/background.cpp
index 4fca89b5310..bfdcde101ce 100644
--- a/src/mongo/util/background.cpp
+++ b/src/mongo/util/background.cpp
@@ -15,20 +15,21 @@
* limitations under the License.
*/
-#include "pch.h"
+#include "mongo/pch.h"
+
+#include "mongo/util/background.h"
#include <boost/thread/condition.hpp>
#include <boost/thread/thread.hpp>
-#include "concurrency/mutex.h"
-#include "concurrency/spin_lock.h"
-
-#include "background.h"
-#include "time_support.h"
-#include "timer.h"
-
-#include "mongoutils/str.h"
+#include "mongo/util/concurrency/mutex.h"
+#include "mongo/util/concurrency/spin_lock.h"
+#include "mongo/util/mongoutils/str.h"
+#include "mongo/util/net/ssl_manager.h"
+#include "mongo/util/time_support.h"
+#include "mongo/util/timer.h"
+using namespace std;
namespace mongo {
// both the BackgroundJob and the internal thread point to JobStatus
@@ -76,6 +77,9 @@ namespace mongo {
status->finished.notify_all();
}
+#ifdef MONGO_SSL
+ SSLManager::cleanupThreadLocals();
+#endif
if( status->deleteSelf )
delete this;
}