def fill_commands_handler(self): self.commands_handler.append(commands.GetCurrentChallengeCommand(self)) self.commands_handler.append(commands.GetChallengeSolutionCommand(self)) self.commands_handler.append(commands.RegisterWalletCommand(self)) self.commands_handler.append(commands.SubmissionCommand(self)) self.commands_handler.append(commands.GetTransactionsCommand(self)) self.commands_handler.append(commands.CreateTransactionCommand(self)) self.commands_handler.append(commands.CaServerInfoCommand(self)) self.commands_handler.append(commands.CloseCommand(self))
def disconnect_application(self): if not self.is_app_running(self.APP_BACKDROP): self.socket.send(commands.CloseCommand(destination_id=False)) start_time = time.time() while not self.is_app_running(None): self.socket.send_and_wait(commands.StatusCommand()) current_time = time.time() if current_time - start_time > self.timeout: raise TimeoutException() time.sleep(self.WAIT_INTERVAL) else: logger.debug('Closing not necessary. Backdrop is running ...')
def disconnect_application(self): if not self.is_app_running(self.APP_BACKDROP): self.socket.send(commands.CloseCommand(destination_id=False)) try: retries = 0 while not self.is_app_running(self.APP_BACKDROP): if retries > self.max_retries: return False self.socket.send_and_wait(commands.StatusCommand()) time.sleep(1) retries += 1 return True except ChannelClosedException: logger.info('Connection was closed. I guess another ' 'client has attached to it.') return True else: logger.debug('Closing not necessary. Backdrop is running ...') return True
def disconnect_channel(self, destination_id): self.socket.send(commands.CloseCommand(destination_id)) self.channels.remove(destination_id)