本文整理汇总了Python中Tribler.Core.Overlay.OverlayThreadingBridge.OverlayThreadingBridge.register_bridge方法的典型用法代码示例。如果您正苦于以下问题:Python OverlayThreadingBridge.register_bridge方法的具体用法?Python OverlayThreadingBridge.register_bridge怎么用?Python OverlayThreadingBridge.register_bridge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tribler.Core.Overlay.OverlayThreadingBridge.OverlayThreadingBridge
的用法示例。
在下文中一共展示了OverlayThreadingBridge.register_bridge方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from Tribler.Core.Overlay.OverlayThreadingBridge import OverlayThreadingBridge [as 别名]
# 或者: from Tribler.Core.Overlay.OverlayThreadingBridge.OverlayThreadingBridge import register_bridge [as 别名]
def setUp(self):
print >>sys.stderr,"test: TestOverlayThreadingBridge.setUp()"
secover1 = SecureOverlay.getInstance()
secover1.resetSingleton()
secover2 = SecureOverlay.getInstance()
secover2.resetSingleton()
overbridge1 = OverlayThreadingBridge()
overbridge1.register_bridge(secover1,None)
overbridge2 = OverlayThreadingBridge()
overbridge2.register_bridge(secover2,None)
self.peer1 = Peer(self,1234,overbridge1)
self.peer2 = Peer(self,5678,overbridge2)
self.peer1.start()
self.peer2.start()
self.wanted = False
self.wanted2 = False
self.got = False
self.got2 = False
self.first = True
print >>sys.stderr,"test: setUp: peer1 permid is",show_permid_short(self.peer1.my_permid)
print >>sys.stderr,"test: setUp: peer2 permid is",show_permid_short(self.peer2.my_permid)
time.sleep(2) # let server threads start
示例2: setUp
# 需要导入模块: from Tribler.Core.Overlay.OverlayThreadingBridge import OverlayThreadingBridge [as 别名]
# 或者: from Tribler.Core.Overlay.OverlayThreadingBridge.OverlayThreadingBridge import register_bridge [as 别名]
def setUp(self):
print >>sys.stderr,"test: TestOverlayThreadingBridge.setUp()"
self.config_path = tempfile.mkdtemp()
config = {}
config['state_dir'] = self.config_path
config['torrent_collecting_dir'] = self.config_path
config['install_dir'] = os.path.join('..','..')
config['peer_icon_path'] = os.path.join(self.config_path,'peer_icons')
config['superpeer'] = False
sqlitecachedb.init(config, self.rawserver_fatalerrorfunc)
secover1 = SecureOverlay.getInstance()
secover1.resetSingleton()
secover2 = SecureOverlay.getInstance()
secover2.resetSingleton()
overbridge1 = OverlayThreadingBridge()
overbridge1.register_bridge(secover1,None)
overbridge1.resetSingleton()
overbridge2 = OverlayThreadingBridge()
overbridge2.register_bridge(secover2,None)
overbridge2.resetSingleton()
self.peer1 = Peer(self,1234,overbridge1)
self.peer2 = Peer(self,5678,overbridge2)
self.peer1.start()
self.peer2.start()
self.wanted = False
self.wanted2 = False
self.got = False
self.got2 = False
self.first = True
print >>sys.stderr,"test: setUp: peer1 permid is",show_permid_short(self.peer1.my_permid)
print >>sys.stderr,"test: setUp: peer2 permid is",show_permid_short(self.peer2.my_permid)
time.sleep(2) # let server threads start