当前位置: 首页>>代码示例>>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;未经允许,请勿转载。