Log interface listener errors.

Fix #133.
This commit is contained in:
Artem Malyshev 2017-08-13 19:18:54 +03:00
parent a69d69490b
commit 3161715238

View File

@ -121,10 +121,19 @@ class Server(object):
logger.info("Listening on endpoint %s" % socket_description)
# Twisted requires str on python2 (not unicode) and str on python3 (not bytes)
ep = serverFromString(reactor, str(socket_description))
self.listeners.append(ep.listen(self.factory))
listener = ep.listen(self.factory)
listener.addErrback(self.on_listener_error)
self.listeners.append(listener)
reactor.run(installSignalHandlers=self.signal_handlers)
def on_listener_error(self, failure):
"""
Callback function used to process interface listener errors.
"""
logger.error(failure.getErrorMessage())
def backend_reader_sync(self):
"""
Runs as an-often-as-possible task with the reactor, unless there was