Browse Source

Fix SIGNPIPE doesn't exist on windows

pull/1105/head
Tony 1 year ago
committed by Hamish Coleman
parent
commit
bfe42e3cc8
  1. 4
      scripts/n2n-httpd

4
scripts/n2n-httpd

@ -456,13 +456,15 @@ def main():
snrpc.debug = args.debug snrpc.debug = args.debug
snrpc.defaultkey = args.key snrpc.defaultkey = args.key
signal.signal(signal.SIGPIPE, signal.SIG_DFL) if hasattr(signal, 'SIGPIPE'):
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
socketserver.TCPServer.allow_reuse_address = True socketserver.TCPServer.allow_reuse_address = True
handler = functools.partial(SimpleHandler, rpc, snrpc) handler = functools.partial(SimpleHandler, rpc, snrpc)
httpd = socketserver.TCPServer(("", args.port), handler) httpd = socketserver.TCPServer(("", args.port), handler)
try: try:
print(f"Serving HTTP at port {args.port} (http://localhost:{args.port}/) ...")
httpd.serve_forever() httpd.serve_forever()
except KeyboardInterrupt: except KeyboardInterrupt:
return return

Loading…
Cancel
Save