Commit 35462e9d authored by Denis Bilenko's avatar Denis Bilenko

make gevent.http 2.4-compatible

- and don't silent KeyboardInterrupt in serve_forever()
parent 5ce1abfa
...@@ -69,10 +69,11 @@ class HTTPServer(object): ...@@ -69,10 +69,11 @@ class HTTPServer(object):
self._done_event = Event() self._done_event = Event()
t = Timeout.start_new(timeout) t = Timeout.start_new(timeout)
try: try:
self._done_event.wait(timeout=timeout) try:
except Timeout, ex: self._done_event.wait(timeout=timeout)
if t is not ex: except Timeout, ex:
raise if t is not ex:
raise
finally: finally:
t.cancel() t.cancel()
#4. forcefull close all the connections #4. forcefull close all the connections
...@@ -141,8 +142,6 @@ class HTTPServer(object): ...@@ -141,8 +142,6 @@ class HTTPServer(object):
if self._serve_forever_event is None: if self._serve_forever_event is None:
self._serve_forever_event = Event() self._serve_forever_event = Event()
self._serve_forever_event.wait() self._serve_forever_event.wait()
except KeyboardInterrupt:
pass
finally: finally:
Greenlet.spawn(self.stop, timeout=stop_timeout).join() Greenlet.spawn(self.stop, timeout=stop_timeout).join()
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