Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: third_party/tlslite/tlslite/sessioncache.py

Issue 210323002: Update tlslite to 0.4.6. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Executable bit and --similarity=80 Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/tlslite/tlslite/session.py ('k') | third_party/tlslite/tlslite/sharedkeydb.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tlslite/tlslite/sessioncache.py
diff --git a/third_party/tlslite/tlslite/sessioncache.py b/third_party/tlslite/tlslite/sessioncache.py
index 34cf0b0ec4e2de8d1f23ff242f9fbc4c8d8fc980..7071d10b067978fba7f74109d071c99870c942ff 100644
--- a/third_party/tlslite/tlslite/sessioncache.py
+++ b/third_party/tlslite/tlslite/sessioncache.py
@@ -1,9 +1,15 @@
+# Authors:
+# Trevor Perrin
+# Martin von Loewis - python 3 port
+#
+# See the LICENSE file for legal information regarding use of this file.
+
"""Class for caching TLS sessions."""
-import thread
+import threading
import time
-class SessionCache:
+class SessionCache(object):
"""This class is used by the server to cache TLS sessions.
Caching sessions allows the client to use TLS session resumption
@@ -31,7 +37,7 @@ class SessionCache:
@param maxAge: The number of seconds before a session expires
from the cache. The default is 14400 (i.e. 4 hours)."""
- self.lock = thread.allocate_lock()
+ self.lock = threading.Lock()
# Maps sessionIDs to sessions
self.entriesDict = {}
@@ -47,7 +53,7 @@ class SessionCache:
self.lock.acquire()
try:
self._purge() #Delete old items, so we're assured of a new one
- session = self.entriesDict[sessionID]
+ session = self.entriesDict[bytes(sessionID)]
#When we add sessions they're resumable, but it's possible
#for the session to be invalidated later on (if a fatal alert
@@ -66,7 +72,7 @@ class SessionCache:
self.lock.acquire()
try:
#Add the new element
- self.entriesDict[sessionID] = session
+ self.entriesDict[bytes(sessionID)] = session
self.entriesList[self.lastIndex] = (sessionID, time.time())
self.lastIndex = (self.lastIndex+1) % len(self.entriesList)
« no previous file with comments | « third_party/tlslite/tlslite/session.py ('k') | third_party/tlslite/tlslite/sharedkeydb.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698