Re: [beep4j-user] seqno incrementing past 4 gigabytes
Status: Alpha
Brought to you by:
rasss
From: Alan D. C. <li...@to...> - 2008-05-20 20:27:11
|
I ran across this problem. I have an ftp-like app where I send down terabytes of data so I was running into this problem all the time. Regards, Alan On May 19, 2008, at 9:58 PM, Thomson, Martin wrote: > There are two places in beep4j where the rollover of the seqno field > isn't correctly handled. Of course, given that you need to send 4 > gigabytes of data over a single channel to reach this point, it's > probably a little theoretical... > > First is in SlidingWindow.remaining(), which currently uses: > > return getEnd() - position; > > This doesn't work if the end has just rolled around to zero, but the > positioning hasn't. This should look like: > > if (position < start) { > return (int) ((start + windowSize) % modulo - position); > } else { > return (int) (start - position + windowSize); > } > > The other place is in the incrementing of the seqno in > DefaultChannelController. This doesn't roll over at all, so when 4Gb > comes around, things will probably break. I've added a method > getNextSeqno that does the incrementing and rollover... > > private long getNextSeqno(int messageSize) { > long nextSeqno = this.seqno; > this.seqno = (this.seqno + messageSize) % (1L << 32); > return nextSeqno; > } > > Ta, > Martin > > ------------------------------------------------------------------------------------------------ > This message is for the designated recipient only and may > contain privileged, proprietary, or otherwise private information. > If you have received it in error, please notify the sender > immediately and delete the original. Any unauthorized use of > this email is prohibited. > ------------------------------------------------------------------------------------------------ > [mf2] > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > beep4j-user mailing list > bee...@li... > https://lists.sourceforge.net/lists/listinfo/beep4j-user > |