def server_main(args):
"""
Implement the server side of the rpkk-router protocol. Other than
one PF_UNIX socket inode, this doesn't write anything to disk, so it
can be run with minimal privileges. Most of the work has already
been done by the database generator, so all this server has to do is
pass the results along to a client.
"""
logger = logging.LoggerAdapter(logging.root, dict(connection = _hostport_tag()))
logger.debug("[Starting]")
if args.rpki_rtr_dir:
try:
os.chdir(args.rpki_rtr_dir)
except OSError, e:
sys.exit(e)
kickme = None
try:
server = rpki.rtr.server.ServerChannel(logger = logger, refresh = args.refresh, retry = args.retry, expire = args.expire)
kickme = rpki.rtr.server.KickmeChannel(server = server)
asyncore.loop(timeout = None)
signal.signal(signal.SIGINT, signal.SIG_IGN) # Theorized race condition
except KeyboardInterrupt:
sys.exit(0)
finally:
signal.signal(signal.SIGINT, signal.SIG_IGN) # Observed race condition
if kickme is not None:
kickme.cleanup()
评论列表
文章目录