Ejemplo n.º 1
0
        def on_message(msgs):
            for msg in msgs:
                term_id, command, data = parse_zmq_message(msg)

                if term_id != _id:
                    logging.warn('Not our message: %s' % term_id)
                    return

                if command == 'input':
                    os.write(master_fd, data)
Ejemplo n.º 2
0
    def on_recv(self, msgs):
        for msg in msgs:
            _id, command, data = parse_zmq_message(msg)

            logging.debug('[terminal %s] -> Command "%s" of len %d bytes' % (_id, command, len(data)))

            if _id in self.listeners:
                for listener in self.listeners[_id]:
                    listener.on_command(command, data)
            else:
                logging.debug('[terminal %s] -> No listener for last command. Available listeners: %s' % (
                    _id, str(self.listeners.keys()))
                )