Example #1
0
    void process_ack(buf_ptr &buf)
    {
        size_t block = super::rlnc_hdr_block(buf);

        if (!validate_block(block))
            return;

        base::put_status(buf->data(), &m_decoder_rank);

        std::cout << "enc ack rank " << m_decoder_rank << std::endl;

        if (m_decoder_rank < super::rlnc_symbols())
            return;

        std::cout << "enc ack block " << block << std::endl;
        increment();
    }
Example #2
0
    bool read_pkt(buf_ptr &buf)
    {
        int res;

        res = read(m_fd, buf->data(), buf->max_len());

        if (res > 0) {
            buf->trim(res);
            return true;
        }

        if (res == 0)
            return false;

        if (res < 0 && errno == EAGAIN)
            return false;

        throw std::system_error(errno, std::system_category(),
                                "unable to read pkt");
    }