Skip to content

Commit

Permalink
Modify CobraProxy's _cobra_getsock method to allow caller to specify …
Browse files Browse the repository at this point in the history
…the thread the socket should be pulled from (defaulting to currentThread(), which was always the thread used before this change.
  • Loading branch information
imjonsnooow committed Dec 30, 2015
1 parent c5f12c0 commit a8a08d4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cobra/__init__.py
Expand Up @@ -1020,11 +1020,13 @@ def cobraAuthenticate(self, authinfo):
return True
return False

def _cobra_getsock(self):
def _cobra_getsock(self, thr=None):
if self._cobra_spoolcnt:
sock = self._cobra_sockpool.get()
else:
thr = currentThread()
if not thr: # if thread isn't specified, use the current thread
thr = currentThread()

tsocks = getattr(thr, 'cobrasocks', None)
if tsocks == None:
tsocks = {}
Expand Down

0 comments on commit a8a08d4

Please sign in to comment.