當前位置: 首頁>>代碼示例>>Python>>正文


Python StreamServer.__init__方法代碼示例

本文整理匯總了Python中gevent.server.StreamServer.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python StreamServer.__init__方法的具體用法?Python StreamServer.__init__怎麽用?Python StreamServer.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在gevent.server.StreamServer的用法示例。


在下文中一共展示了StreamServer.__init__方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from gevent.server import StreamServer [as 別名]
# 或者: from gevent.server.StreamServer import __init__ [as 別名]
def __init__(self, listener, application=None, backlog=None, spawn='default',
                 log='default', error_log='default',
                 handler_class=None,
                 environ=None, **ssl_args):
        StreamServer.__init__(self, listener, backlog=backlog, spawn=spawn, **ssl_args)
        if application is not None:
            self.application = application
        if handler_class is not None:
            self.handler_class = handler_class

        # Note that we can't initialize these as class variables:
        # sys.stderr might get monkey patched at runtime.
        def _make_log(l, level=20):
            if l == 'default':
                return sys.stderr
            if l is None:
                return _NoopLog()
            if not hasattr(l, 'write') and hasattr(l, 'log'):
                return LoggingLogAdapter(l, level)
            return l
        self.log = _make_log(log)
        self.error_log = _make_log(error_log, 40) # logging.ERROR

        self.set_environ(environ)
        self.set_max_accept() 
開發者ID:leancloud,項目名稱:satori,代碼行數:27,代碼來源:pywsgi.py

示例2: __init__

# 需要導入模塊: from gevent.server import StreamServer [as 別名]
# 或者: from gevent.server.StreamServer import __init__ [as 別名]
def __init__(self, config):
        self.config = config
        self.upstream = None

        listener = ("0.0.0.0", config.get("port", 7070))
        StreamServer.__init__(self, listener, backlog=1024, )

        config_upstream = config.get("upstream", {'type': 'direct'})
        type = config_upstream.get('type', None)
        if type is None:
            raise ConfigError(u'[upstream]未配置代理類型!詳細信息:%s' % config_upstream)
        Upstream = upstream.get_upstream(type)
        if Upstream is None:
            raise ConfigError(u'[upstream]不支持 %s 類型代理!' % type)

        self.upstream = Upstream(config_upstream) 
開發者ID:GameXG,項目名稱:TcpRoute,代碼行數:18,代碼來源:server.py

示例3: __init__

# 需要導入模塊: from gevent.server import StreamServer [as 別名]
# 或者: from gevent.server.StreamServer import __init__ [as 別名]
def __init__(self, sock, fobj, stderr):
        self._sock = sock
        self._fobj = fobj
        self.stderr = stderr 
開發者ID:leancloud,項目名稱:satori,代碼行數:6,代碼來源:backdoor.py

示例4: __init__

# 需要導入模塊: from gevent.server import StreamServer [as 別名]
# 或者: from gevent.server.StreamServer import __init__ [as 別名]
def __init__(self, listener, profiler=None, interval=INTERVAL,
                 log=LOG, pickle_protocol=PICKLE_PROTOCOL, **server_kwargs):
        StreamServer.__init__(self, listener, **server_kwargs)
        ProfilingServer.__init__(self, profiler, interval,
                                 log, pickle_protocol)
        self.lock = Semaphore()
        self.profiling_greenlet = None 
開發者ID:what-studio,項目名稱:profiling,代碼行數:9,代碼來源:gevent.py

示例5: __init__

# 需要導入模塊: from gevent.server import StreamServer [as 別名]
# 或者: from gevent.server.StreamServer import __init__ [as 別名]
def __init__(self, listener, dest, **kwargs):
        StreamServer.__init__(self, listener, **kwargs)
        self.dest = dest 
開發者ID:dongweiming,項目名稱:web_develop,代碼行數:5,代碼來源:portforwarder.py

示例6: __init__

# 需要導入模塊: from gevent.server import StreamServer [as 別名]
# 或者: from gevent.server.StreamServer import __init__ [as 別名]
def __init__(self, stratum_server):
        self.server = stratum_server
        self.config = stratum_server.config 
開發者ID:simplecrypto,項目名稱:powerpool,代碼行數:5,代碼來源:agent_server.py

示例7: start

# 需要導入模塊: from gevent.server import StreamServer [as 別名]
# 或者: from gevent.server.StreamServer import __init__ [as 別名]
def start(self, *args, **kwargs):
        self.logger = self.server.logger
        self.listener = (self.config['address'],
                         self.config['port'] +
                         self.config['agent']['port_diff'] +
                         self.server.manager.config['server_number'])
        StreamServer.__init__(self, self.listener, spawn=Pool())
        self.logger.info("Agent server starting up on {}".format(self.listener))
        StreamServer.start(self, *args, **kwargs)
        Component.start(self) 
開發者ID:simplecrypto,項目名稱:powerpool,代碼行數:12,代碼來源:agent_server.py

示例8: __init__

# 需要導入模塊: from gevent.server import StreamServer [as 別名]
# 或者: from gevent.server.StreamServer import __init__ [as 別名]
def __init__(self, config):
        self._configure(config)
        self.agent_servers = []

        # Start a corresponding agent server
        if self.config['agent']['enabled']:
            serv = AgentServer(self)
            self.agent_servers.append(serv)

        # A dictionary of all connected clients indexed by id
        self.clients = {}
        self.agent_clients = {}
        # A dictionary of lists of connected clients indexed by address
        self.address_lut = {}
        # A dictionary of lists of connected clients indexed by address and
        # worker tuple
        self.address_worker_lut = {}
        # counters that allow quick display of these numbers. stratum only
        self.authed_clients = 0
        self.idle_clients = 0
        # Unique client ID counters for stratum and agents. We want them to
        # unique across all clients on all servers, so we seed with some unique
        # starting number
        self.stratum_id_count = (self.config['port'] * 10000 +
                                 self.config['server_seed'])
        self.agent_id_count = 0

        # Track the last job we pushed and when we pushed it
        self.last_flush_job = None
        self.last_flush_time = None
        self.last_job = None
        self.last_time = None
        self.listener = None
        # Keep track of the jobs we've recieved, both recently flushed and
        # active
        self.active_jobs = set()
        # Nothing ever actually needs to be looked up in this object, it merely
        # has to hold reference to the job objects so they don't get garbage
        # collected
        self.stale_jobs = deque([], maxlen=10) 
開發者ID:simplecrypto,項目名稱:powerpool,代碼行數:42,代碼來源:stratum_server.py

示例9: __init__

# 需要導入模塊: from gevent.server import StreamServer [as 別名]
# 或者: from gevent.server.StreamServer import __init__ [as 別名]
def __init__(self, listener=None, backlog=None, noisy=None):
        if listener is None:
            listener = ('0.0.0.0', 843)
        if noisy is not None:
            self.noisy = noisy
        StreamServer.__init__(self, listener=listener, backlog=backlog) 
開發者ID:EventGhost,項目名稱:EventGhost,代碼行數:8,代碼來源:policyserver.py

示例10: __init__

# 需要導入模塊: from gevent.server import StreamServer [as 別名]
# 或者: from gevent.server.StreamServer import __init__ [as 別名]
def __init__(self, rfile, content_length, socket=None, chunked_input=False):
        self.rfile = rfile
        self.content_length = content_length
        self.socket = socket
        self.position = 0
        self.chunked_input = chunked_input
        self.chunk_length = -1
        self._chunked_input_error = False 
開發者ID:mchristopher,項目名稱:PokemonGo-DesktopMap,代碼行數:10,代碼來源:pywsgi.py


注:本文中的gevent.server.StreamServer.__init__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。