def send_command(self, command: common.Command): try: common.write_message(self.socket, command) return True except common.ClientDisconnectedException: self.handle_connection_lost() return False
def send_command(self, command: common.Command): """ Directly send a command to the socket. Meant to be used by this thread. """ assert threading.current_thread() is self.thread if _log_server_updates or command.type not in ( common.MessageType.CLIENT_UPDATE, common.MessageType.ROOM_UPDATE, ): logger.debug("Sending to %s:%s - %s", self.address[0], self.address[1], command.type) common.write_message(self.socket, command)