From 8c1b7f8a5a7403e464938aa0aa6876557ec6a2b3 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Wed, 10 Feb 2016 19:23:52 +0000 Subject: [PATCH] Allow signal handlers to be disabled to run in subthread --- daphne/server.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/daphne/server.py b/daphne/server.py index 0e2d432..7615959 100755 --- a/daphne/server.py +++ b/daphne/server.py @@ -6,16 +6,17 @@ from .http_protocol import HTTPFactory class Server(object): - def __init__(self, channel_layer, host="127.0.0.1", port=8000): + def __init__(self, channel_layer, host="127.0.0.1", port=8000, signal_handlers=True): self.channel_layer = channel_layer self.host = host self.port = port + self.signal_handlers = signal_handlers def run(self): self.factory = HTTPFactory(self.channel_layer) reactor.listenTCP(self.port, self.factory, interface=self.host) reactor.callInThread(self.backend_reader) - reactor.run() + reactor.run(installSignalHandlers=self.signal_handlers) def backend_reader(self): """