fix for a bug noticed when using --keep-alive --threads on IIS/MSSQL

This commit is contained in:
Miroslav Stampar 2011-02-03 15:09:53 +00:00
parent b3859824d9
commit a8fea8e4a8

View File

@ -97,8 +97,8 @@ class HTTPHandler(urllib2.HTTPHandler):
"""return a list of connected hosts""" """return a list of connected hosts"""
retVal = [] retVal = []
currentThread = threading.currentThread() currentThread = threading.currentThread()
for thread, host in self._connections.keys(): for name, host in self._connections.keys():
if thread == currentThread: if name == currentThread.getName():
retVal.append(host) retVal.append(host)
return retVal return retVal
@ -115,7 +115,7 @@ class HTTPHandler(urllib2.HTTPHandler):
del self._connections[key] del self._connections[key]
def _get_connection_key(self, host): def _get_connection_key(self, host):
return (threading.currentThread(), host) return (threading.currentThread().getName(), host)
def _start_connection(self, h, req): def _start_connection(self, h, req):
h.clearheaders() h.clearheaders()