Exemplo n.º 1
0
    def start(self):
        """
        Start a Tribler session by initializing the LaunchManyCore class, opening the database and running the upgrader.
        Returns a deferred that fires when the Tribler session is ready for use.
        """

        # Start the REST API before the upgrader since we want to send interesting upgrader events over the socket
        if self.get_http_api_enabled():
            self.lm.api_manager = RESTManager(self)
            self.readable_status = STATE_START_API
            self.lm.api_manager.start()

        self.start_database()

        # We clean the mugshot since it isn't used anymore and often contains data unsuitable for sending over the API.
        self.set_mugshot(None)

        if self.upgrader_enabled:
            upgrader = TriblerUpgrader(self, self.sqlite_db)
            self.readable_status = STATE_UPGRADING_READABLE
            upgrader.run()

        startup_deferred = self.lm.register(self, self.sesslock)

        def load_checkpoint(_):
            if self.get_libtorrent():
                self.readable_status = STATE_LOAD_CHECKPOINTS
                self.load_checkpoint()
            self.readable_status = STATE_READABLE_STARTED

        self.sessconfig.set_callback(self.lm.sessconfig_changed_callback)

        return startup_deferred.addCallback(load_checkpoint)
Exemplo n.º 2
0
    def start(self):
        """
        Start a Tribler session by initializing the LaunchManyCore class, opening the database and running the upgrader.
        Returns a deferred that fires when the Tribler session is ready for use.
        """
        # Start the REST API before the upgrader since we want to send interesting upgrader events over the socket
        if self.config.get_http_api_enabled():
            self.lm.api_manager = RESTManager(self)
            self.readable_status = STATE_START_API
            self.lm.api_manager.start()

        if self.upgrader_enabled:
            self.upgrader = TriblerUpgrader(self)
            self.readable_status = STATE_UPGRADING_READABLE
            self.upgrader.run()

        startup_deferred = self.lm.register(self, self.session_lock)

        def load_checkpoint(_):
            if self.config.get_libtorrent_enabled():
                self.readable_status = STATE_LOAD_CHECKPOINTS
                self.load_checkpoint()
            self.readable_status = STATE_READABLE_STARTED

        return startup_deferred.addCallback(load_checkpoint)
Exemplo n.º 3
0
    def start(self):
        """
        Start a Tribler session by initializing the LaunchManyCore class, opening the database and running the upgrader.
        Returns a deferred that fires when the Tribler session is ready for use.
        """

        # Start the REST API before the upgrader since we want to send interesting upgrader events over the socket
        if self.get_http_api_enabled():
            self.lm.api_manager = RESTManager(self)
            self.lm.api_manager.start()

        self.start_database()

        if self.get_upgrader_enabled():
            self.upgrader = TriblerUpgrader(self, self.sqlite_db)
            self.upgrader.run()

        startup_deferred = self.lm.register(self, self.sesslock)

        def load_checkpoint(_):
            if self.get_libtorrent():
                self.load_checkpoint()

        self.sessconfig.set_callback(self.lm.sessconfig_changed_callback)

        return startup_deferred.addCallback(load_checkpoint)