noticed little DoS behavior and lots of connections in netstat (best way to deal with zombie connections is to explicitly close them if not needed any more)

This commit is contained in:
Miroslav Stampar 2010-12-26 14:36:51 +00:00
parent c4d6a367e9
commit f2373121d0

View File

@ -231,6 +231,14 @@ class Connect:
responseHeaders = conn.info() responseHeaders = conn.info()
page = decodePage(page, responseHeaders.get("Content-Encoding"), responseHeaders.get("Content-Type")) page = decodePage(page, responseHeaders.get("Content-Encoding"), responseHeaders.get("Content-Type"))
# Explicit closing of connection object
if not conf.keepAlive:
try:
conn.close()
except Exception, msg:
warnMsg = "problem occured during connection closing ('%s')" % msg
logger.warn(warnMsg)
except urllib2.HTTPError, e: except urllib2.HTTPError, e:
code = e.code code = e.code
status = e.msg status = e.msg