def OnExit(self): if self.started and not self.use_service: try: sb_server.stop() except: print("Error stopping proxy at shutdown") traceback.print_exc() print("Shutting down anyway...") self.started = False DestroyWindow(self.hwnd) PostQuitMessage(0)
def Stop(self): self.CheckCurrentState() if not self.started: print("Ignoring stop request - server doesn't appear to be running") return try: use_service = self.use_service if use_service: if verbose: print("Doing 'Stop' via service") if self.GetServiceStatus() not in stoppedStatus: self.StopService() else: print("Service was already stopped - weird - falling " \ "back to a socket based quit") use_service = False if not use_service: if verbose: print("Stopping local server") sb_server.stop() except: print("There was an error stopping the server") traceback.print_exc() self.started = False self.UpdateUIState()
def SvcStop(self): self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) self.event_stopping.set() sb_server.stop()