File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434#include " P_SSLUtils.h"
3535
3636#include < mutex>
37+ #include < shared_mutex>
3738#include < unordered_map>
3839#include < utility>
3940#include < vector>
@@ -234,24 +235,24 @@ ssl_create_ticket_keyblock(const char *ticket_key_path)
234235
235236SSLCertContext::SSLCertContext (SSLCertContext const &other)
236237{
238+ std::shared_lock lock (other.ctx_mutex );
237239 opt = other.opt ;
238240 userconfig = other.userconfig ;
239241 keyblock = other.keyblock ;
240242 ctx_type = other.ctx_type ;
241- std::shared_lock lock (other.ctx_mutex );
242- ctx = other.ctx ;
243+ ctx = other.ctx ;
243244}
244245
245246SSLCertContext &
246247SSLCertContext::operator =(SSLCertContext const &other)
247248{
248249 if (&other != this ) {
250+ std::scoped_lock lock (this ->ctx_mutex , other.ctx_mutex );
249251 this ->opt = other.opt ;
250252 this ->userconfig = other.userconfig ;
251253 this ->keyblock = other.keyblock ;
252254 this ->ctx_type = other.ctx_type ;
253- std::shared_lock lock (other.ctx_mutex );
254- this ->ctx = other.ctx ;
255+ this ->ctx = other.ctx ;
255256 }
256257 return *this ;
257258}
You can’t perform that action at this time.
0 commit comments