On 09/08/2013 06:16 PM, Scott Talbert wrote: > On Sun, 8 Sep 2013, Phil Dibowitz wrote: > >>> + /* >>> + * Second parameter in the read file "ack" message is the data length. >>> Use >>> + * this to determine the number of packets we should expect. >>> + */ >>> + uint32_t data_len = (rsp[7] << 24) + (rsp[8] << 16) + (rsp[9] << 8) + >>> + rsp[10]; >>> + int pkts_to_read = data_len / MH_MAX_DATA_SIZE; >>> + if ((data_len % MH_MAX_DATA_SIZE) != 0) >>> + pkts_to_read++; >>> + pkts_to_read++; // count is always one more than the actual count >> >> I was willing to buy that until I saw: >> >>> + pkts_to_read--; >>> + if (pkts_to_read == 1) { >>> + break; >>> + } >> >> This. If you stop when you have one more to read, then really the original >> number was correct, no? > > Yes, but the problem is, the 'ack' message to the remote has a field that > is the number of packets to read, plus one (don't ask me why, I didn't > design the protocol). We use this 'pkts_to_read' variable to populate > that 'ack' message, so pkts_to_read always is one more than the number of > packets we're actually planning to read. For example, if we need to read > 43 packets, we start with pkts_to_read = 44 and go until pkts_to_read = 1.
Ah. I would have just made the ack message with "pkts_to_read+1" each time (more ops, but also more sensicle in my brain), but it's such a minor preference thing, I'm not gonna worry about it. I'll merge it. -- Phil Dibowitz p...@ipom.com Open Source software and tech docs Insanity Palace of Metallica http://www.phildev.net/ http://www.ipom.com/ "Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind." - Dr. Seuss
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________ concordance-devel mailing list concordance-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/concordance-devel