Merge "NSXv3: Race condition fix for cert provider"

This commit is contained in:
Jenkins 2017-06-17 06:22:08 +00:00 committed by Gerrit Code Review
commit 1a1dc6fc96
1 changed files with 5 additions and 1 deletions

View File

@ -53,7 +53,11 @@ class DbCertProvider(client_cert.ClientCertProvider):
# Such collisions are handled with refcount and locking.
super(DbCertProvider, self).__init__(None)
random.seed()
self.refcount = 0
with self.lock:
# Initialize refcount if other threads did not do it already
if not hasattr(self, 'refcount'):
self.refcount = 0
def _check_expiration(self, expires_in_days):
if expires_in_days > self.EXPIRATION_ALERT_DAYS: