0

I am playing with a flute protocol application called mad_flute. http://mad.cs.tut.fi/

Everything works well except when I try to send a file larger then 30GB. (Or more than 65536) blocks. The application has 1 sending part and 1 reciving. The sending side seams to be working and you can see it send all blocks "88462/88462 Source Blocks sent (TOI=1 SBN=88461)" Reciver side always stops at "65536/88462 Source Blocks decoded (TOI=1 SBN=65535)"

I did find one INT16 variable in the source but adjusting that did not resolve the issue.

Next, I found a logical "Delta2 = 65535 - Delat1;" part in the mad_rlc.c and bumped that value up but still reciver stops at "65536/88462 Source Blocks decoded (TOI=1 SBN=65535)"

Source can be downloaded form here: http://mad.cs.tut.fi/download/mad_fcl_v1.7_src.zip

Any pointers from a C king/queen would be amazing.

int mad_rlc_check_sequence(alc_session_t *s, int layer, int seqid) {
unsigned short Delta1;
unsigned short Delta2;

int i;
int late_limit;

if(s->rlc->rx_wait_for[layer] == seqid) {
    /* This is the packet we're waiting for, let's go on! */
    s->rlc->rx_wait_for[layer]++;
    return 0;
}

/* This is not the one we're waiting for... */
if(s->rlc->rx_wait_for[layer] < seqid) {

    Delta1 = seqid - s->rlc->rx_wait_for[layer];
    Delta2 = 65535 - Delta1;

    if(Delta1 < Delta2) {

        late_limit = RLC_MAX_LATES;

        for(i = s->rlc->rx_wait_for[layer]; i < seqid; i++) {
            mad_rlc_add_late(s, layer, i);
            late_limit--;
            if(late_limit <= 0 ) {
                printf("RLC Warning*** Max number of LATE packets reached\n");
                fflush(stdout);
                break;
            }
        }
        /* EOFIX */
        s->rlc->rx_wait_for[layer] = seqid + 1;
    }
    else {
        /* Late arrival packet (uint16 overflow) */
        /* eg. we're waiting seq 4 and we get seq 65532 */
        mad_rlc_remove_late(s, layer, seqid);
    }
}
else { /* rx_wait_for > rlc_seqid */

    Delta1 = s->rlc->rx_wait_for[layer] - seqid;
    Delta2 = 65535 - Delta1;
    if (Delta1 < Delta2) { /* Late arrival packet */
    /* ie: we're waiting seq 501 and we get seq 498 */
        mad_rlc_remove_late(s, layer, seqid);
    }
    else {
    /* Some packet(s) are missing (uint16 overflow) */
    /* ie: waiting seq 65531 and get seq 3 */
        /* FIX 14/12/01 */
        late_limit = RLC_MAX_LATES;
        for(i = s->rlc->rx_wait_for[layer]; i != (seqid-1); i++) {
            mad_rlc_add_late(s, layer, i);
            late_limit--;
            if(late_limit <= 0 ) {
                printf("RLC Warning*** Max number of LATE packets reached\n");
                fflush(stdout);
                break;
            }
        }
        /* EOFIX */
        s->rlc->rx_wait_for[layer] = seqid + 1;
    }
}

return 0;

}

WebFooL
  • 53
  • 5
  • 1
    It sounds a lot as if you might be using an unsigned 16-bit counter somewhere and it wraps around to 0 after 65535. Are you using `unsigned short` or `uint16_t` anywhere? (You said you found one place.) Maybe the protocol doesn't allow for files as big as 30 GiB? We can't help you because there's no code in the question. Telling us where something can be downloaded doesn't count, I'm afraid. Please read about how to create an MCVE ([MCVE]). – Jonathan Leffler Nov 27 '18 at 21:43
  • my fist way around I looked for int16 or unit16 and found one in the receiver component and has corrected that one. The protocol in itself does not have any issues with larger files and the sending side will continue to send blocks. Just the receiver part that stops after 65535 blocks. I will add to the original post a where in the logic i think the issue is. – WebFooL Nov 28 '18 at 06:24
  • Will try to define Delta1 and Delta2 as unsigned long instead of short. And then change 65535 to 4294967295 in the "Delta 2 = value - Delta1;" Now i just need to get back to my build box and test it – WebFooL Nov 28 '18 at 18:46

0 Answers0