Exit gracefully when socket fails to open
This fixes prevents a traceback that was shown when trying to listen to an address on which 'bind' fails.
This commit is contained in:
parent
99f83ca083
commit
f05cd203de
|
|
@ -718,6 +718,7 @@ class WebSockifyServer():
|
|||
be overridden) for each new client connection.
|
||||
"""
|
||||
|
||||
try:
|
||||
if self.listen_fd != None:
|
||||
lsock = socket.fromfd(self.listen_fd, socket.AF_INET, socket.SOCK_STREAM)
|
||||
elif self.unix_listen != None:
|
||||
|
|
@ -732,6 +733,10 @@ class WebSockifyServer():
|
|||
tcp_keepcnt=self.tcp_keepcnt,
|
||||
tcp_keepidle=self.tcp_keepidle,
|
||||
tcp_keepintvl=self.tcp_keepintvl)
|
||||
except OSError as e:
|
||||
self.msg("Openening socket failed: %s", str(e))
|
||||
self.vmsg("exception", exc_info=True)
|
||||
sys.exit()
|
||||
|
||||
if self.daemon:
|
||||
keepfd = self.get_log_fd()
|
||||
|
|
|
|||
Loading…
Reference in New Issue