示例#1
0
    def __init__(self,
                 address,
                 application=None,
                 server_class='wsgi',
                 number=1,
                 user=None,
                 pythonpath=None,
                 preexec=None,
                 respawn=True,
                 timeout_shutdown=None,
                 timeout_pipe=None):
        self.server_class = server_class
        self.family, self.address = parse_address(address)
        self.application = application
        self.number = number
        self.setuid, self.setgid = self.get_uidgid(user)
        self.pythonpath = pythonpath
        self.preexec = preexec
        self.respawn = respawn

        if timeout_shutdown is None:
            timeout_shutdown = self.DEFAULT_TIMEOUT_SHUTDOWN
        self.timeout_shutdown = timeout_shutdown

        if timeout_pipe is None:
            timeout_pipe = self.DEFAULT_TIMEOUT_PIPE
        self.timeout_pipe = timeout_pipe

        self.workers = []
        self.greenlet = None
        self.last_exit_code = None
        self.fork_rate = RateCount(60)
示例#2
0
    def __init__(
        self,
        address,
        application=None,
        server_class="wsgi",
        number=1,
        user=None,
        pythonpath=None,
        preexec=None,
        respawn=True,
        timeout_shutdown=None,
        timeout_pipe=None,
    ):
        self.server_class = server_class
        self.family, self.address = parse_address(address)
        self.application = application
        self.number = number
        self.setuid, self.setgid = self.get_uidgid(user)
        self.pythonpath = pythonpath
        self.preexec = preexec
        self.respawn = respawn

        if timeout_shutdown is None:
            timeout_shutdown = self.DEFAULT_TIMEOUT_SHUTDOWN
        self.timeout_shutdown = timeout_shutdown

        if timeout_pipe is None:
            timeout_pipe = self.DEFAULT_TIMEOUT_PIPE
        self.timeout_pipe = timeout_pipe

        self.workers = []
        self.greenlet = None
        self.last_exit_code = None
        self.fork_rate = RateCount(60)
示例#3
0
 def set_server(self, server):
     if hasattr(server, 'accept'):
         if hasattr(server, 'do_handshake'):
             raise TypeError('Expected a regular socket, not SSLSocket: %r' % (server, ))
         self.server_family = server.family
         self.server_address = server.getsockname()
     else:
         self.server_family, self.server_address = parse_address(server)
示例#4
0
def get_lisener(port, host=''):
    lisener = None
    while lisener is None:
        family, address = parse_address((host, port))
        try:
            lisener = WSGIServer.get_listener(address, family=family)
        except Exception, e:
            pass
        port += 1
示例#5
0
def get_lisener(port, host=''):
    lisener = None
    while lisener is None:
        family, address = parse_address((host, port))
        try:
            lisener = WSGIServer.get_listener(address, family=family)
        except Exception, e:
            pass
        port += 1
示例#6
0
def get_lisener(port, host=''):
    if not host:
        host = get_ip_address()
    lisener = None
    while lisener is None:
        family, address = parse_address((host, port))
        try:
            lisener = WSGIServer.get_listener(address, family=family)
        except Exception:
            pass
        port += 1
    return lisener