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


Python OverlayThreadingBridge.resetSingleton方法代碼示例

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


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

示例1: setUp

# 需要導入模塊: from Tribler.Core.Overlay.OverlayThreadingBridge import OverlayThreadingBridge [as 別名]
# 或者: from Tribler.Core.Overlay.OverlayThreadingBridge.OverlayThreadingBridge import resetSingleton [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
開發者ID:Devristo,項目名稱:tribler,代碼行數:43,代碼來源:test_overlay_bridge.py


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