dddp/main.py
def serve(listen, verbosity=1, debug_port=0, **ssl_args):
    """Spawn greenlets for handling websockets and PostgreSQL calls."""
    launcher = DDPLauncher(debug=verbosity == 3, verbosity=verbosity)
    if debug_port:
        launcher.servers.append(
            launcher.get_backdoor_server('localhost:%d' % debug_port)
        )
    launcher.add_web_servers(listen, **ssl_args)
    # die gracefully with SIGINT or SIGQUIT
    sigmap = {
        val: name
        for name, val
        in vars(signal).items()
        if name.startswith('SIG')
    }

    def sighandler(signum=None, frame=None):
        """Signal handler"""
        launcher.logger.info(
            'Received signal %s in frame %r',
            sigmap.get(signum, signum),
            frame,
        )
        launcher.stop()
    for signum in [signal.SIGINT, signal.SIGQUIT]:
        gevent.signal(signum, sighandler)
    launcher.run()
def serve(listen, verbosity=1, debug_port=0, **ssl_args):
    """Spawn greenlets for handling websockets and PostgreSQL calls."""
    launcher = DDPLauncher(debug=verbosity == 3, verbosity=verbosity)
    if debug_port:
        launcher.servers.append(
            launcher.get_backdoor_server('localhost:%d' % debug_port)
        )
    launcher.add_web_servers(listen, **ssl_args)
    # die gracefully with SIGINT or SIGQUIT
    sigmap = {
        val: name
        for name, val
        in vars(signal).items()
        if name.startswith('SIG')
    }

    def sighandler(signum=None, frame=None):
        """Signal handler"""
        launcher.logger.info(
            'Received signal %s in frame %r',
            sigmap.get(signum, signum),
            frame,
        )
        launcher.stop()
    for signum in [signal.SIGINT, signal.SIGQUIT]:
        gevent.signal(signum, sighandler)
    launcher.run()
Spawn greenlets for handling websockets and PostgreSQL calls.