Пример #1
0
    bool write_pkt(buf_ptr &buf_in)
    {
        buf_ptr buf_out = super::buffer();
        put_pkt(buf_in);

        do {
            get_pkt(buf_out);
            super::write_pkt(buf_out);
            buf_out->reset();
        } while (super::decrease_budget());

        return true;
    }
Пример #2
0
    bool read_pkt(buf_ptr &buf_out)
    {
        buf_ptr buf_in = super::buffer();

        if (!is_done() && is_partial_complete()) {
            get_pkt(buf_out);
            return true;
        } else if (is_done()) {
            increment();
            return false;
        }

        while (true) {
            super::rlnc_hdr_reserve(buf_in);

            if (!super::read_pkt(buf_in))
                break;

            if (!validate_type(buf_in))
                continue;

            put_pkt(buf_in);
            process_rank();
            buf_in->reset();

            if (is_complete()) {
                send_ack(super::rlnc_hdr_block(), base::m_coder->rank());
                break;
            }
        }

        if (!is_partial_complete())
            return false;

        get_pkt(buf_out);

        return true;
    }