Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
server, protocol = loop.run_until_complete(option.start_udp_server(vars(args)))
servers.append(server)
except Exception as ex:
print('Start server failed.\n\t==>', ex)
for option in args.rserver:
if option.backward:
print('Serving on', option.bind, 'backward by', ",".join(i.name for i in option.protos) + ('(SSL)' if option.sslclient else ''), '({}{})'.format(option.cipher.name, ' '+','.join(i.name() for i in option.cipher.plugins) if option.cipher and option.cipher.plugins else '') if option.cipher else '')
try:
server = loop.run_until_complete(option.backward.client_run())
servers.append(server)
except Exception as ex:
print('Start server failed.\n\t==>', ex)
if servers:
if args.sys:
from . import sysproxy
args.sys = sysproxy.setup(args)
if args.alived > 0 and args.rserver:
asyncio.ensure_future(check_server_alive(args.alived, args.rserver, args.verbose if args.v else DUMMY))
try:
loop.run_forever()
except KeyboardInterrupt:
print('exit')
if args.sys:
args.sys.clear()
for task in asyncio.Task.all_tasks():
task.cancel()
for server in servers:
server.close()
for server in servers:
if hasattr(server, 'wait_closed'):
loop.run_until_complete(server.wait_closed())
loop.run_until_complete(loop.shutdown_asyncgens())