server.py 文件源码

python
阅读 40 收藏 0 点赞 0 评论 0

项目:RPKI-toolkit 作者: pavel-odintsov 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号