Commit 1d57310e authored by Denis Bilenko's avatar Denis Bilenko

pywsgi: stop processing requests if self.socket is set to None

this is needed for websocket which needs to own the connection
parent bbda6b9a
...@@ -158,7 +158,7 @@ class WSGIHandler(object): ...@@ -158,7 +158,7 @@ class WSGIHandler(object):
def handle(self): def handle(self):
try: try:
while True: while self.socket is not None:
self.time_start = time.time() self.time_start = time.time()
self.time_finish = 0 self.time_finish = 0
result = self.handle_one_request() result = self.handle_one_request()
...@@ -173,6 +173,7 @@ class WSGIHandler(object): ...@@ -173,6 +173,7 @@ class WSGIHandler(object):
self.log_request() self.log_request()
break break
finally: finally:
if self.socket is not None:
try: try:
self.socket._sock.close() # do not rely on garbage collection self.socket._sock.close() # do not rely on garbage collection
self.socket.close() self.socket.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment