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


Python TorrentDBHandler.close方法代码示例

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


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

示例1: TestContentRepositoryWithRealDatabase

# 需要导入模块: from Tribler.Core.CacheDB.SqliteCacheDBHandler import TorrentDBHandler [as 别名]
# 或者: from Tribler.Core.CacheDB.SqliteCacheDBHandler.TorrentDBHandler import close [as 别名]
class TestContentRepositoryWithRealDatabase(TestBase):
    """
    Tests content repository with real database.
    """

    def setUp(self):
        super(TestContentRepositoryWithRealDatabase, self).setUp()

        session_base_dir = self.temporary_directory()
        tar = tarfile.open(os.path.join(TESTS_DATA_DIR, 'bak_new_tribler.sdb.tar.gz'), 'r|gz')
        tar.extractall(session_base_dir)
        db_path = os.path.join(session_base_dir, 'bak_new_tribler.sdb')
        self.sqlitedb = SQLiteCacheDB(db_path, busytimeout=BUSYTIMEOUT)

        session = MockObject()
        session.sqlite_db = self.sqlitedb
        session.notifier = MockObject()

        self.torrent_db = TorrentDBHandler(session)
        channel_db = MockObject()
        self.content_repository = ContentRepository(self.torrent_db, channel_db)

    def tearDown(self):
        self.torrent_db.close()
        self.sqlitedb.close()
        super(TestContentRepositoryWithRealDatabase, self).tearDown()

    def test_update_db_from_search_results(self):
        """
        Test if database is properly updated with the search results.
        Should not raise any UnicodeDecodeError.
        """
        # Add a torrent infohash before updating from search results
        infohash = unhexlify('ed81da94d21ad1b305133f2726cdaec5a57fed98')
        self.content_repository.torrent_db.addOrGetTorrentID(infohash)

        # Sample search results
        name = 'Puppy.Linux.manual.301.espa\xc3\xb1ol.pdf'
        length = random.randint(1000, 9999)
        num_files = random.randint(1, 10)
        category_list = ['other']
        creation_date = random.randint(1000000, 111111111)
        seeders = random.randint(10, 200)
        leechers = random.randint(5, 1000)
        cid = None
        search_results = [[infohash, name, length, num_files, category_list, creation_date, seeders, leechers, cid]]

        # Update from search results
        self.content_repository.update_from_torrent_search_results(search_results)

        # Check if database has correct results
        torrent_info = self.content_repository.get_torrent(infohash)
        expected_name = u'Puppy.Linux.manual.301.espa\xc3\xb1ol.pdf'
        self.assertEqual(expected_name, torrent_info['name'])
        self.assertEqual(seeders, torrent_info['num_seeders'])
        self.assertEqual(leechers, torrent_info['num_leechers'])
        self.assertEqual(creation_date, torrent_info['creation_date'])
        self.assertEqual(num_files, torrent_info['num_files'])
        self.assertEqual(length, torrent_info['length'])
开发者ID:synctext,项目名称:tribler,代码行数:61,代码来源:test_repository.py

示例2: reimport_torrents

# 需要导入模块: from Tribler.Core.CacheDB.SqliteCacheDBHandler import TorrentDBHandler [as 别名]
# 或者: from Tribler.Core.CacheDB.SqliteCacheDBHandler.TorrentDBHandler import close [as 别名]
    def reimport_torrents(self):
        """Import all torrent files in the collected torrent dir, all the files already in the database will be ignored.
        """
        self.status_update_func("Opening TorrentDBHandler...")
        # TODO(emilon): That's a freakishly ugly hack.
        torrent_db_handler = TorrentDBHandler(self.session)
        torrent_db_handler.category = Category()

        # TODO(emilon): It would be nice to drop the corrupted torrent data from the store as a bonus.
        self.status_update_func("Registering recovered torrents...")
        try:
            for infoshash_str, torrent_data in self.torrent_store.iteritems():
                self.status_update_func("> %s" % infoshash_str)
                torrentdef = TorrentDef.load_from_memory(torrent_data)
                if torrentdef.is_finalized():
                    infohash = torrentdef.get_infohash()
                    if not torrent_db_handler.hasTorrent(infohash):
                        self.status_update_func(u"Registering recovered torrent: %s" % hexlify(infohash))
                        torrent_db_handler._addTorrentToDB(torrentdef, extra_info={"filename": infoshash_str})
        finally:
            torrent_db_handler.close()
            self.db.commit_now()
            return self.torrent_store.flush()
开发者ID:synctext,项目名称:tribler,代码行数:25,代码来源:db_upgrader.py

示例3: TriblerLaunchMany

# 需要导入模块: from Tribler.Core.CacheDB.SqliteCacheDBHandler import TorrentDBHandler [as 别名]
# 或者: from Tribler.Core.CacheDB.SqliteCacheDBHandler.TorrentDBHandler import close [as 别名]

#.........这里部分代码省略.........

        if self.tftp_handler is not None:
            yield self.tftp_handler.shutdown()
        self.tftp_handler = None

        if self.tunnel_community and self.trustchain_community:
            # We unload these overlays manually since the TrustChain has to be unloaded after the tunnel overlay.
            tunnel_community = self.tunnel_community
            self.tunnel_community = None
            yield self.ipv8.unload_overlay(tunnel_community)
            trustchain_community = self.trustchain_community
            self.trustchain_community = None
            yield self.ipv8.unload_overlay(trustchain_community)

        if self.dispersy:
            self._logger.info("lmc: Shutting down Dispersy...")
            now = timemod.time()
            try:
                success = yield self.dispersy.stop()
            except:
                print_exc()
                success = False

            diff = timemod.time() - now
            if success:
                self._logger.info("lmc: Dispersy successfully shutdown in %.2f seconds", diff)
            else:
                self._logger.info("lmc: Dispersy failed to shutdown in %.2f seconds", diff)

        if self.ipv8:
            yield self.ipv8.stop(stop_reactor=False)

        if self.metadata_store is not None:
            yield self.metadata_store.close()
        self.metadata_store = None

        if self.channelcast_db is not None:
            yield self.channelcast_db.close()
        self.channelcast_db = None

        if self.votecast_db is not None:
            yield self.votecast_db.close()
        self.votecast_db = None

        if self.mypref_db is not None:
            yield self.mypref_db.close()
        self.mypref_db = None

        if self.torrent_db is not None:
            yield self.torrent_db.close()
        self.torrent_db = None

        if self.peer_db is not None:
            yield self.peer_db.close()
        self.peer_db = None

        if self.mainline_dht is not None:
            from Tribler.Core.DecentralizedTracking import mainlineDHT
            yield mainlineDHT.deinit(self.mainline_dht)
        self.mainline_dht = None

        if self.torrent_store is not None:
            yield self.torrent_store.close()
        self.torrent_store = None

        if self.watch_folder is not None:
开发者ID:synctext,项目名称:tribler,代码行数:70,代码来源:LaunchManyCore.py

示例4: TestMyPreferenceDBHandler

# 需要导入模块: from Tribler.Core.CacheDB.SqliteCacheDBHandler import TorrentDBHandler [as 别名]
# 或者: from Tribler.Core.CacheDB.SqliteCacheDBHandler.TorrentDBHandler import close [as 别名]
class TestMyPreferenceDBHandler(AbstractDB):

    @inlineCallbacks
    def setUp(self):
        yield super(TestMyPreferenceDBHandler, self).setUp()

        self.tdb = TorrentDBHandler(self.session)
        self.mdb = MyPreferenceDBHandler(self.session)
        self.mdb._torrent_db = self.tdb

    def tearDown(self):
        self.mdb.close()
        self.mdb = None
        self.tdb.close()
        self.tdb = None

        super(TestMyPreferenceDBHandler, self).tearDown()

    def test_getPrefList(self):
        pl = self.mdb.getMyPrefListInfohash()
        self.assertEqual(len(pl), 12)

    def test_addMyPreference_deletePreference(self):
        p = self.mdb.getOne(('torrent_id', 'destination_path', 'creation_time'), torrent_id=126)
        torrent_id = p[0]
        infohash = self.tdb.getInfohash(torrent_id)
        destpath = p[1]
        creation_time = p[2]
        self.mdb.deletePreference(torrent_id)
        pl = self.mdb.getMyPrefListInfohash()
        self.assertEqual(len(pl), 12)
        self.assertIn(infohash, pl)

        data = {'destination_path': destpath}
        self.mdb.addMyPreference(torrent_id, data)
        p2 = self.mdb.getOne(('torrent_id', 'destination_path', 'creation_time'), torrent_id=126)
        self.assertTrue(p2[0] == p[0])
        self.assertTrue(p2[1] == p[1])

        self.mdb.deletePreference(torrent_id)
        pl = self.mdb.getMyPrefListInfohash(returnDeleted=False)
        self.assertEqual(len(pl), 11)
        self.assertNotIn(infohash, pl)

        data = {'destination_path': destpath, 'creation_time': creation_time}
        self.mdb.addMyPreference(torrent_id, data)
        p3 = self.mdb.getOne(('torrent_id', 'destination_path', 'creation_time'), torrent_id=126)
        self.assertEqual(p3, p)

    def test_getMyPrefListInfohash(self):
        preflist = self.mdb.getMyPrefListInfohash()
        for p in preflist:
            self.assertTrue(not p or len(p) == 20)
        self.assertEqual(len(preflist), 12)

    def test_get_my_pref_stats(self):
        res = self.mdb.getMyPrefStats()
        self.assertEqual(len(res), 12)
        for k in res:
            data = res[k]
            self.assertIsInstance(data, basestring, "data is not destination_path: %s" % type(data))

        res = self.mdb.getMyPrefStats(torrent_id=126)
        self.assertEqual(len(res), 1)

    def test_my_pref_stats_infohash(self):
        infohash = str2bin('AB8cTG7ZuPsyblbRE7CyxsrKUCg=')
        self.assertIsNone(self.mdb.getMyPrefStatsInfohash(infohash))
        infohash = str2bin('ByJho7yj9mWY1ORWgCZykLbU1Xc=')
        self.assertTrue(self.mdb.getMyPrefStatsInfohash(infohash))

    def test_get_my_pref_list_infohash_limit(self):
        self.assertEqual(len(self.mdb.getMyPrefListInfohash(limit=10)), 10)

    def test_add_my_preference(self):
        self.assertTrue(self.mdb.addMyPreference(127, {'destination_path': 'C:/mytorrent'}))
        self.assertTrue(self.mdb.addMyPreference(12345678, {'destination_path': 'C:/mytorrent'}))
        self.assertFalse(self.mdb.addMyPreference(12345678, {'destination_path': 'C:/mytorrent'}))

    def test_delete_my_preference(self):
        self.mdb.deletePreference(126)
        res = self.mdb.getMyPrefStats(126)
        self.assertFalse(res[126])
        self.mdb.deletePreference(12348934)

    def test_update_dest_dir(self):
        self.mdb.updateDestDir(126, 'C:/mydest')
        res = self.mdb.getMyPrefStats(126)
        self.assertEqual(res[126], 'C:/mydest')
        self.mdb.updateDestDir(126, {})
        self.assertEqual(res[126], 'C:/mydest')
开发者ID:synctext,项目名称:tribler,代码行数:93,代码来源:test_sqlitecachedbhandler_preferences.py

示例5: TestTorrentDBHandler

# 需要导入模块: from Tribler.Core.CacheDB.SqliteCacheDBHandler import TorrentDBHandler [as 别名]
# 或者: from Tribler.Core.CacheDB.SqliteCacheDBHandler.TorrentDBHandler import close [as 别名]

#.........这里部分代码省略.........
                               other_key1='abcd', other_key2=123)
        multiple_torrent_id = self.tdb.getTorrentID(m_infohash)
        category = self.tdb.getOne('category', torrent_id=multiple_torrent_id)
        self.assertEqual(category, u'Videoclips')
        status = self.tdb.getOne('status', torrent_id=multiple_torrent_id)
        self.assertEqual(status, u'good')
        seeder = self.tdb.getOne('num_seeders', torrent_id=multiple_torrent_id)
        self.assertEqual(seeder, 123)
        leecher = self.tdb.getOne('num_leechers', torrent_id=multiple_torrent_id)
        self.assertEqual(leecher, 321)
        last_tracker_check = self.tdb.getOne('last_tracker_check', torrent_id=multiple_torrent_id)
        self.assertEqual(last_tracker_check, 1234567)

    def setUpPreSession(self):
        super(TestTorrentDBHandler, self).setUpPreSession()
        self.config.set_megacache_enabled(True)
        self.config.set_torrent_store_enabled(True)

    @inlineCallbacks
    def setUp(self):
        yield super(TestTorrentDBHandler, self).setUp()

        from Tribler.Core.APIImplementation.LaunchManyCore import TriblerLaunchMany
        from Tribler.Core.Modules.tracker_manager import TrackerManager
        self.session.lm = TriblerLaunchMany()
        self.session.lm.tracker_manager = TrackerManager(self.session)
        self.tdb = TorrentDBHandler(self.session)
        self.tdb.torrent_dir = TESTS_DATA_DIR
        self.tdb.category = Category()
        self.tdb.mypref_db = MyPreferenceDBHandler(self.session)

    @inlineCallbacks
    def tearDown(self):
        self.tdb.mypref_db.close()
        self.tdb.mypref_db = None
        self.tdb.close()
        self.tdb = None

        yield super(TestTorrentDBHandler, self).tearDown()

    def test_hasTorrent(self):
        infohash_str = 'AA8cTG7ZuPsyblbRE7CyxsrKUCg='
        infohash = str2bin(infohash_str)
        self.assertTrue(self.tdb.hasTorrent(infohash))
        self.assertTrue(self.tdb.hasTorrent(infohash)) # cache will trigger
        fake_infohash = 'fake_infohash_100000'
        self.assertFalse(self.tdb.hasTorrent(fake_infohash))

    def test_get_infohash(self):
        self.assertTrue(self.tdb.getInfohash(1))
        self.assertFalse(self.tdb.getInfohash(1234567))

    def test_add_update_torrent(self):
        self.addTorrent()
        self.updateTorrent()

    def test_update_torrent_from_metainfo(self):
        # Add torrent first
        infohash = unhexlify('ed81da94d21ad1b305133f2726cdaec5a57fed98')
        # Only infohash is added to the database
        self.tdb.addOrGetTorrentID(infohash)

        # Then update the torrent with metainfo
        metainfo = {'info': {'files': [{'path': ['Something.something.pdf'], 'length': 123456789},
                                       {'path': ['Another-thing.jpg'], 'length': 100000000}],
                             'piece length': 2097152,
开发者ID:synctext,项目名称:tribler,代码行数:70,代码来源:test_sqlitecachedbhandler_torrents.py

示例6: TestMyPreferenceDBHandler

# 需要导入模块: from Tribler.Core.CacheDB.SqliteCacheDBHandler import TorrentDBHandler [as 别名]
# 或者: from Tribler.Core.CacheDB.SqliteCacheDBHandler.TorrentDBHandler import close [as 别名]
class TestMyPreferenceDBHandler(AbstractDB):

    def setUp(self):
        super(TestMyPreferenceDBHandler, self).setUp()

        self.tdb = TorrentDBHandler(self.session)
        self.mdb = MyPreferenceDBHandler(self.session)
        self.mdb._torrent_db = self.tdb

    @blocking_call_on_reactor_thread
    def tearDown(self):
        self.mdb.close()
        self.mdb = None
        self.tdb.close()
        self.tdb = None

        super(TestMyPreferenceDBHandler, self).tearDown()

    @blocking_call_on_reactor_thread
    def test_getPrefList(self):
        pl = self.mdb.getMyPrefListInfohash()
        assert len(pl) == 12

    @skip("We are going to rewrite the whole database thing, so its not worth the trouble fixing this now")
    @blocking_call_on_reactor_thread
    def test_addMyPreference_deletePreference(self):
        p = self.mdb.getOne(('torrent_id', 'destination_path', 'creation_time'), torrent_id=126)
        torrent_id = p[0]
        infohash = self.tdb.getInfohash(torrent_id)
        destpath = p[1]
        creation_time = p[2]
        self.mdb.deletePreference(torrent_id)
        pl = self.mdb.getMyPrefListInfohash()
        assert len(pl) == 22
        assert infohash not in pl

        data = {'destination_path': destpath}
        self.mdb.addMyPreference(torrent_id, data)
        p2 = self.mdb.getOne(('torrent_id', 'destination_path', 'creation_time'), torrent_id=126)
        assert p2[0] == p[0] and p2[1] == p[1] and time() - p2[2] < 10, p2

        self.mdb.deletePreference(torrent_id)
        pl = self.mdb.getMyPrefListInfohash()
        assert len(pl) == 22
        assert infohash not in pl

        data = {'destination_path': destpath, 'creation_time': creation_time}
        self.mdb.addMyPreference(torrent_id, data)
        p3 = self.mdb.getOne(('torrent_id', 'destination_path', 'creation_time'), torrent_id=126)
        assert p3 == p, p3

    @blocking_call_on_reactor_thread
    def test_getMyPrefListInfohash(self):
        preflist = self.mdb.getMyPrefListInfohash()
        for p in preflist:
            assert not p or len(p) == 20, len(p)
        assert len(preflist) == 12, u"preflist length = %s" % len(preflist)

    @blocking_call_on_reactor_thread
    def test_getMyPrefStats(self):
        res = self.mdb.getMyPrefStats()
        assert len(res) == 12
        for k in res:
            data = res[k]
            assert isinstance(data, basestring), "data is not destination_path: %s" % type(data)
开发者ID:Antiade,项目名称:tribler,代码行数:67,代码来源:test_sqlitecachedbhandler.py

示例7: TestTorrentDBHandler

# 需要导入模块: from Tribler.Core.CacheDB.SqliteCacheDBHandler import TorrentDBHandler [as 别名]
# 或者: from Tribler.Core.CacheDB.SqliteCacheDBHandler.TorrentDBHandler import close [as 别名]
class TestTorrentDBHandler(AbstractDB):

    def setUp(self):
        super(TestTorrentDBHandler, self).setUp()

        from Tribler.Core.APIImplementation.LaunchManyCore import TriblerLaunchMany
        from Tribler.Core.Modules.tracker_manager import TrackerManager
        self.session.lm = TriblerLaunchMany()
        self.session.lm.tracker_manager = TrackerManager(self.session)
        self.session.lm.tracker_manager.initialize()
        self.tdb = TorrentDBHandler(self.session)
        self.tdb.torrent_dir = TESTS_DATA_DIR
        self.tdb.category = Category.getInstance(self.session)
        self.tdb.mypref_db = MyPreferenceDBHandler(self.session)

    @blocking_call_on_reactor_thread
    def tearDown(self):
        self.tdb.mypref_db.close()
        self.tdb.mypref_db = None
        self.tdb.close()
        self.tdb = None

        super(TestTorrentDBHandler, self).tearDown()

    @blocking_call_on_reactor_thread
    def test_hasTorrent(self):
        infohash_str = 'AA8cTG7ZuPsyblbRE7CyxsrKUCg='
        infohash = str2bin(infohash_str)
        assert self.tdb.hasTorrent(infohash)
        fake_infoahsh = 'fake_infohash_100000'
        assert self.tdb.hasTorrent(fake_infoahsh) == False

    @blocking_call_on_reactor_thread
    def test_add_update_Torrent(self):
        self.addTorrent()
        self.updateTorrent()

    @blocking_call_on_reactor_thread
    def addTorrent(self):
        old_size = self.tdb.size()
        old_tracker_size = self.tdb._db.size('TrackerInfo')

        s_infohash = unhexlify('44865489ac16e2f34ea0cd3043cfd970cc24ec09')
        m_infohash = unhexlify('ed81da94d21ad1b305133f2726cdaec5a57fed98')

        sid = self.tdb.getTorrentID(s_infohash)
        mid = self.tdb.getTorrentID(m_infohash)

        single_torrent_file_path = os.path.join(self.getStateDir(), 'single.torrent')
        multiple_torrent_file_path = os.path.join(self.getStateDir(), 'multiple.torrent')

        copyFile(S_TORRENT_PATH_BACKUP, single_torrent_file_path)
        copyFile(M_TORRENT_PATH_BACKUP, multiple_torrent_file_path)

        single_tdef = TorrentDef.load(single_torrent_file_path)
        assert s_infohash == single_tdef.get_infohash()
        multiple_tdef = TorrentDef.load(multiple_torrent_file_path)
        assert m_infohash == multiple_tdef.get_infohash()

        self.tdb.addExternalTorrent(single_tdef)
        self.tdb.addExternalTorrent(multiple_tdef)

        single_torrent_id = self.tdb.getTorrentID(s_infohash)
        multiple_torrent_id = self.tdb.getTorrentID(m_infohash)

        assert self.tdb.getInfohash(single_torrent_id) == s_infohash

        single_name = 'Tribler_4.1.7_src.zip'
        multiple_name = 'Tribler_4.1.7_src'

        assert self.tdb.size() == old_size + 2, old_size - self.tdb.size()
        new_tracker_table_size = self.tdb._db.size('TrackerInfo')
        assert old_tracker_size < new_tracker_table_size, new_tracker_table_size - old_tracker_size

        sname = self.tdb.getOne('name', torrent_id=single_torrent_id)
        assert sname == single_name, (sname, single_name)
        mname = self.tdb.getOne('name', torrent_id=multiple_torrent_id)
        assert mname == multiple_name, (mname, multiple_name)

        s_size = self.tdb.getOne('length', torrent_id=single_torrent_id)
        assert s_size == 1583233, s_size
        m_size = self.tdb.getOne('length', torrent_id=multiple_torrent_id)
        assert m_size == 5358560, m_size

        cat = self.tdb.getOne('category', torrent_id=multiple_torrent_id)
        assert cat == u'xxx', cat

        s_status = self.tdb.getOne('status', torrent_id=single_torrent_id)
        assert s_status == u'unknown', s_status

        m_comment = self.tdb.getOne('comment', torrent_id=multiple_torrent_id)
        comments = 'www.tribler.org'
        assert m_comment.find(comments) > -1
        comments = 'something not inside'
        assert m_comment.find(comments) == -1

        m_trackers = self.tdb.getTrackerListByInfohash(m_infohash)
        assert len(m_trackers) == 8
        assert 'http://tpb.tracker.thepiratebay.org/announce' in m_trackers, m_trackers

#.........这里部分代码省略.........
开发者ID:Antiade,项目名称:tribler,代码行数:103,代码来源:test_sqlitecachedbhandler.py

示例8: TriblerLaunchMany

# 需要导入模块: from Tribler.Core.CacheDB.SqliteCacheDBHandler import TorrentDBHandler [as 别名]
# 或者: from Tribler.Core.CacheDB.SqliteCacheDBHandler.TorrentDBHandler import close [as 别名]

#.........这里部分代码省略.........
        if self.channel_manager:
            self.channel_manager.shutdown()
            self.channel_manager = None
        if self.search_manager:
            self.search_manager.shutdown()
            self.search_manager = None
        if self.rtorrent_handler:
            self.rtorrent_handler.shutdown()
            self.rtorrent_handler = None
        if self.videoplayer:
            self.videoplayer.shutdown()
            self.videoplayer = None

        if self.tracker_manager:
            self.tracker_manager.shutdown()
            self.tracker_manager = None

        if self.dispersy:
            self._logger.info("lmc: Shutting down Dispersy...")
            now = timemod.time()
            try:
                success = self.dispersy.stop()
            except:
                print_exc()
                success = False

            diff = timemod.time() - now
            if success:
                self._logger.info("lmc: Dispersy successfully shutdown in %.2f seconds", diff)
            else:
                self._logger.info("lmc: Dispersy failed to shutdown in %.2f seconds", diff)

        if self.metadata_store is not None:
            self.metadata_store.close()
            self.metadata_store = None

        if self.tftp_handler:
            self.tftp_handler.shutdown()
            self.tftp_handler = None

        if self.session.get_megacache():
            self.channelcast_db.close()
            self.votecast_db.close()
            self.mypref_db.close()
            self.torrent_db.close()
            self.peer_db.close()

            self.channelcast_db = None
            self.votecast_db = None
            self.mypref_db = None
            self.torrent_db = None
            self.peer_db = None

        if self.mainline_dht:
            from Tribler.Core.DecentralizedTracking import mainlineDHT
            mainlineDHT.deinit(self.mainline_dht)
            self.mainline_dht = None

        if self.torrent_store is not None:
            self.torrent_store.close()
            self.torrent_store = None

    def network_shutdown(self):
        try:
            self._logger.info("tlm: network_shutdown")
开发者ID:Antiade,项目名称:tribler,代码行数:69,代码来源:LaunchManyCore.py


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