コード例 #1
0
ファイル: BitBlinder.py プロジェクト: clawplach/BitBlinder
 def _on_bank_stopped(self, result):
   Basic.validate_result(result, "bank_stopped")
   #now stop tor:
   log_msg("Waiting for Tor to shut down...", 3)
   d = None
   if self.torApp:
     d = self.torApp.stop()
   if not d:
     d = self._on_tor_stopped(True)
   else:
     d.addCallback(self._on_tor_stopped)
     d.addErrback(self._on_tor_stopped)
   return d
コード例 #2
0
 def _on_bank_stopped(self, result):
     Basic.validate_result(result, "bank_stopped")
     #now stop tor:
     log_msg("Waiting for Tor to shut down...", 3)
     d = None
     if self.torApp:
         d = self.torApp.stop()
     if not d:
         d = self._on_tor_stopped(True)
     else:
         d.addCallback(self._on_tor_stopped)
         d.addErrback(self._on_tor_stopped)
     return d
コード例 #3
0
 def _on_applications_stopped(self, result):
     Basic.validate_result(result, "applications_stopped")
     self.isReady = False
     HTTPClient.stop_all()
     #now stop the bank:
     log_msg("Waiting for the bank to shut down...", 3)
     d = None
     if self.bankApp:
         d = self.bankApp.stop()
     if not d:
         d = self._on_bank_stopped(True)
     else:
         d.addCallback(self._on_bank_stopped)
         d.addErrback(self._on_bank_stopped)
     return d
コード例 #4
0
ファイル: BitBlinder.py プロジェクト: clawplach/BitBlinder
 def _on_applications_stopped(self, result):
   Basic.validate_result(result, "applications_stopped")
   self.isReady = False
   HTTPClient.stop_all()
   #now stop the bank:
   log_msg("Waiting for the bank to shut down...", 3)
   d = None
   if self.bankApp:
     d = self.bankApp.stop()
   if not d:
     d = self._on_bank_stopped(True)
   else:
     d.addCallback(self._on_bank_stopped)
     d.addErrback(self._on_bank_stopped)
   return d
コード例 #5
0
 def _startup_success(self, result):
     self.startupDeferred = None
     self.isReady = True
     result = Basic.validate_result(result, "BitBlinder startup")
     if not result:
         self.stop()
     self._trigger_event("started")
     return result
コード例 #6
0
ファイル: BitBlinder.py プロジェクト: clawplach/BitBlinder
 def _startup_success(self, result):
   self.startupDeferred = None
   self.isReady = True
   result = Basic.validate_result(result, "BitBlinder startup")
   if not result:
     self.stop()
   self._trigger_event("started")
   return result
コード例 #7
0
 def _shutdown(self, result):
     """Stop the main loop and cause the program to exit.
 This should ONLY be called after all Applications are shut down cleanly."""
     Basic.validate_result(result, "MainLoop::_shutdown")
     #close the server that listens for new versions of the app to start up:
     StartupServer.stop()
     #remove scheduled events:
     if self.updateEvent and self.updateEvent.active():
         self.updateEvent.cancel()
     ProgramState.DO_UPDATES = False
     self.updateEvent = None
     GlobalEvents.throw_event("shutdown")
     log_msg("Done with shutdown deferreds", 4)
     #close the main loop
     if ProgramState.USE_GTK:
         try:
             gtk.main_quit()
         except Exception, error:
             log_ex(error, "Couldn't kill the gtk main loop")
コード例 #8
0
ファイル: MainLoop.py プロジェクト: clawplach/BitBlinder
 def _shutdown(self, result):
   """Stop the main loop and cause the program to exit.
   This should ONLY be called after all Applications are shut down cleanly."""
   Basic.validate_result(result, "MainLoop::_shutdown")
   #close the server that listens for new versions of the app to start up:
   StartupServer.stop()
   #remove scheduled events:
   if self.updateEvent and self.updateEvent.active():
     self.updateEvent.cancel()
   ProgramState.DO_UPDATES = False
   self.updateEvent = None
   GlobalEvents.throw_event("shutdown")
   log_msg("Done with shutdown deferreds", 4)
   #close the main loop
   if ProgramState.USE_GTK:
     try:
       gtk.main_quit()
     except Exception, error:
       log_ex(error, "Couldn't kill the gtk main loop")
コード例 #9
0
 def _stop_done(self, result):
   Basic.validate_result(result, "BitTorrentWindow::_stop_done")
   if not BitBlinder.get().is_running():
     GlobalEvents.throw_event("quit_signal")
   else:
     #are there any other apps using bitblinder?
     for app in BitBlinder.get().applications.values():
       #if there is another app, dont bother shutting down everything
       if app.is_running() and app != Bank.get():
         return
     #ok, check if there is a relay then
     if Tor.get().settings.beRelay:
       #then we should prompt about shutdown
       def callback(dialog, response):
         if response == gtk.RESPONSE_YES:
           self._do_quit()
       msgText = "BitBlinder is acting as a server and help others be anonymous, and earning you more credits!\n\nDo you also want to stop the server?"
       GUIController.get().show_preference_prompt(msgText, "Stop Relay?", callback, "promptAboutRelayQuit")
     else:
       #otherwise shutdown completely:
       self._do_quit()
コード例 #10
0
    def _stop_done(self, result):
        Basic.validate_result(result, "BitTorrentWindow::_stop_done")
        if not BitBlinder.get().is_running():
            GlobalEvents.throw_event("quit_signal")
        else:
            #are there any other apps using bitblinder?
            for app in BitBlinder.get().applications.values():
                #if there is another app, dont bother shutting down everything
                if app.is_running() and app != Bank.get():
                    return
            #ok, check if there is a relay then
            if Tor.get().settings.beRelay:
                #then we should prompt about shutdown
                def callback(dialog, response):
                    if response == gtk.RESPONSE_YES:
                        self._do_quit()

                msgText = "BitBlinder is acting as a server and help others be anonymous, and earning you more credits!\n\nDo you also want to stop the server?"
                GUIController.get().show_preference_prompt(
                    msgText, "Stop Relay?", callback, "promptAboutRelayQuit")
            else:
                #otherwise shutdown completely:
                self._do_quit()
コード例 #11
0
ファイル: Application.py プロジェクト: clawplach/BitBlinder
 def _stop_when_started(self, result, cancelDeferred):
   Basic.validate_result(result, "_stop_when_started")
   self.stop().chainDeferred(cancelDeferred)
コード例 #12
0
 def _quit_done(self, result):
   Basic.validate_result(result, "BitTorrentWindow::_quit_done")
   GlobalEvents.throw_event("quit_signal")
コード例 #13
0
 def _stop_when_started(self, result, cancelDeferred):
     Basic.validate_result(result, "_stop_when_started")
     self.stop().chainDeferred(cancelDeferred)
コード例 #14
0
 def _on_tor_stopped(self, result):
     Basic.validate_result(result, "tor_stopped")
     log_msg("BitBlinder finished.", 3)
     #finally done shutting down
     return defer.succeed(True)
コード例 #15
0
ファイル: BitBlinder.py プロジェクト: clawplach/BitBlinder
 def _on_tor_stopped(self, result):
   Basic.validate_result(result, "tor_stopped")
   log_msg("BitBlinder finished.", 3)
   #finally done shutting down
   return defer.succeed(True)
コード例 #16
0
 def _quit_done(self, result):
     Basic.validate_result(result, "BitTorrentWindow::_quit_done")
     GlobalEvents.throw_event("quit_signal")