On Wed, 20 Mar 2002, Edouard Gomez wrote:

> Oh ! What a stupid "bug", not really a bug but... I can explain
> you why this bit of code is there (the src = atm_cells + tmp)
> 
> Reason :
> 
> When we receive data which length is not zero modulo 48, that's
> we received garbage either at the beginning or at the end of the
> data. I remember, I hesitated to set the default behaviour to
> ignore the beginning or the end of the data. So i tested both
> solution but as none is really better (because both are valid
> or i should say an easy workaround of the problem).
> 
> So now the solutions :
> 
> /* Skip data at the beginning */
> dst = ...;
> src = atm_cells;
> 
> if(!tmp) {    <<<<<<<<<< if(tmp) {   :-)
>   src += tmp;
>   length -= tmp;
> }
> 
> or the other solution
> 
> /* Skip data at the end */
> dst = ...;
> src = atm_cells;
> 
> if(!tmp)    <<<<<<<<<<<< if(tmp)
>   length -= tmp;
> 
> But i think the first solution is a better one. 1 reason :
>   - if we skip the end of the data, we surely skip
>     the aal5 "header" that is at the end. Not a good
>     solution :\
> 
> Do you agree ?
> 
Don't know. Obviously the second (with correction) is what is happening at 
the moment and most people don't seem to be complaining.

How about:

src = atm_cells;

if(tmp) {
    length -= tmp;
    if(*(src+2) == (vci & 0x00000ff0) >> 4) {
        /* assume corruption is at the end */
    } else {
        /* assume corruption is at the beginning */
        src+=tmp;
    }
}


or possibly ...

src = atm_cells;

if(tmp) {
    int i;
    length -= tmp;
    for(i = 0; i < tmp; i++,src++) {
        if(*(src+2+i) == (vci & 0x00000ff0) >> 4) {
            break;
        }
    }
}

Tim.

-- 
God said, "div D = rho, div B = 0, curl E = - @B/@t, curl H = J + @D/@t," 
and there was light.

     http://tjw.hn.org/      http://www.locofungus.btinternet.co.uk/



Liste de diffusion modem ALCATEL SpeedTouch USB
Pour se désinscrire : mailto:[EMAIL PROTECTED]?subject=unsubscribe

        

Reply via email to