mirror of
https://github.com/django/daphne.git
synced 2024-11-25 17:23:43 +03:00
Store endpoint listen results. (#92)
* Store endpoint listen results. * Rename ports to listeners.
This commit is contained in:
parent
7f92a48293
commit
3cd048d594
|
@ -50,6 +50,7 @@ class Server(object):
|
||||||
if len(self.endpoints) == 0:
|
if len(self.endpoints) == 0:
|
||||||
raise UserWarning("No endpoints. This server will not listen on anything.")
|
raise UserWarning("No endpoints. This server will not listen on anything.")
|
||||||
|
|
||||||
|
self.listeners = []
|
||||||
self.signal_handlers = signal_handlers
|
self.signal_handlers = signal_handlers
|
||||||
self.action_logger = action_logger
|
self.action_logger = action_logger
|
||||||
self.http_timeout = http_timeout
|
self.http_timeout = http_timeout
|
||||||
|
@ -96,7 +97,7 @@ class Server(object):
|
||||||
logger.info("Listening on endpoint %s" % socket_description)
|
logger.info("Listening on endpoint %s" % socket_description)
|
||||||
# Twisted requires str on python2 (not unicode) and str on python3 (not bytes)
|
# Twisted requires str on python2 (not unicode) and str on python3 (not bytes)
|
||||||
ep = serverFromString(reactor, str(socket_description))
|
ep = serverFromString(reactor, str(socket_description))
|
||||||
ep.listen(self.factory)
|
self.listeners.append(ep.listen(self.factory))
|
||||||
|
|
||||||
reactor.run(installSignalHandlers=self.signal_handlers)
|
reactor.run(installSignalHandlers=self.signal_handlers)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user