Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if self.pending_sync_command is not None:
yield from self.pending_sync_command.wait()
if Commands.get(command.name).exec == Exec.is_sync:
if self.pending_async_commands:
yield from self.wait_async_pending_commands()
self.pending_sync_command = command
else:
if self.pending_async_commands.get(command.untagged_resp_name) is not None:
yield from self.pending_async_commands[command.untagged_resp_name].wait()
self.pending_async_commands[command.untagged_resp_name] = command
self.send(str(command))
try:
yield from command.wait()
except CommandTimeout:
if Commands.get(command.name).exec == Exec.is_sync:
self.pending_sync_command = None
else:
self.pending_async_commands.pop(command.untagged_resp_name, None)
raise
return command.response
def _timeout_callback(self):
self._exception = CommandTimeout(self)
self.close(str(self._exception), 'KO')