From 4d2f26b1cd74f5bc269b03733ee578341099ab49 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 25 Jan 2017 11:20:15 -0500 Subject: [PATCH] limit number of precalculated DH pairs --- Transports.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Transports.cpp b/Transports.cpp index 1659eeed..5b188a7d 100644 --- a/Transports.cpp +++ b/Transports.cpp @@ -101,8 +101,9 @@ namespace transport void DHKeysPairSupplier::Return (std::shared_ptr pair) { - std::unique_lock l(m_AcquiredMutex); - m_Queue.push (pair); + std::unique_lockl(m_AcquiredMutex); + if ((int)m_Queue.size () < 2*m_QueueSize) + m_Queue.push (pair); } Transports transports;