当前位置: 首页>>代码示例>>Python>>正文


Python Channel.setup_connection方法代码示例

本文整理汇总了Python中Channel.setup_connection方法的典型用法代码示例。如果您正苦于以下问题:Python Channel.setup_connection方法的具体用法?Python Channel.setup_connection怎么用?Python Channel.setup_connection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Channel的用法示例。


在下文中一共展示了Channel.setup_connection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _manage_channels

# 需要导入模块: import Channel [as 别名]
# 或者: from Channel import setup_connection [as 别名]
 def _manage_channels(self):
     assert self.state_lock.locked()
     for cid, channel in self.active_channels.items():
         message = 'Location channel management removing %r from active.'
         if not channel.accepting_requests():
             self.debugout(message % channel, 1)
             self.active_channels.pop(cid)
             self.parallel_channels.decrement()
     maxchannels = self.MAXPARALLELCHANNELS
     numpending = len(self.pending_transactions)
     numchannels = self.parallel_channels.value
     if numchannels == 0:
         createchannel = True
     elif numchannels >= maxchannels:
         createchannel = False
     elif (numpending / numchannels) > self.IDEALBACKLOG:
         createchannel = True
     else:
         createchannel = False
     if createchannel:
         channel = Channel(self.monitor, self.debug)
         channel.setup_connection(self.host, self.port, self.protocol)
         self.free_channels.append(channel)
         self.parallel_channels.increment()
     return
开发者ID:mcruse,项目名称:monotone,代码行数:27,代码来源:asynchronous.py

示例2: send_request

# 需要导入模块: import Channel [as 别名]
# 或者: from Channel import setup_connection [as 别名]
 def send_request(self):
     channel = Channel(self.tm._monitor)
     self.set_channel(channel)
     channel.socket = None
     channel.setup_connection(
         self.request.get_host(),
         self.request.get_port(),
         self.request.get_type()
         )
     channel.send_request(self.request)
     self.send_time = uptime.secs()
     return
开发者ID:mcruse,项目名称:monotone,代码行数:14,代码来源:http_client.py


注:本文中的Channel.setup_connection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。