Commit 4a9e3894 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

--HG--
extra : transplant_source : %C2%FF%0C%9F%C0%C3h%23%18M%F9%8CL%1D%E7%29%5B%85%3B%2A
parent 4df8475b
......@@ -158,7 +158,7 @@ class WSGIHandler(object):
def handle(self):
try:
while True:
while self.socket is not None:
self.time_start = time.time()
self.time_finish = 0
result = self.handle_one_request()
......@@ -173,11 +173,12 @@ class WSGIHandler(object):
self.log_request()
break
finally:
try:
self.socket._sock.close() # do not rely on garbage collection
self.socket.close()
except socket.error:
pass
if self.socket is not None:
try:
self.socket._sock.close() # do not rely on garbage collection
self.socket.close()
except socket.error:
pass
self.__dict__.pop('socket', None)
self.__dict__.pop('rfile', None)
self.__dict__.pop('wfile', None)
......
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