Fix a socket leak in case of broken connection

Change-Id: I39cbbe5915ab95fb0927b0899b8f09870b4c0b07
This commit is contained in:
Romain LE DISEZ 2017-09-26 14:57:26 +02:00
parent ccf9f6a4e0
commit fc21cde1c2
1 changed files with 8 additions and 0 deletions

View File

@ -131,6 +131,11 @@ class InputProxy(object):
self.bytes_received += len(line)
return line
def close(self):
close_method = getattr(self.wsgi_input, 'close', None)
if callable(close_method):
close_method()
class KeystoneClientLoader(ksa_adapter.Adapter):
"""Keystone client adapter loader.
@ -272,6 +277,9 @@ class Swift(object):
except StopIteration:
chunk = ''
finally:
close_method = getattr(iterable, 'close', None)
if callable(close_method):
close_method()
self.emit_event(env, input_proxy.bytes_received, bytes_sent)
try: