本文整理汇总了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
示例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