Re: [twsocket] BUG REPORT: Division by zero

2012-10-17 Thread Arno Garrels
Vladimir Kudelin wrote:
> Therefore, I had to apply the following fix:
> 
>if Tick = FPrevTick then
>FCurSpeed := 0
>else
>FCurSpeed := 8 * (FTotalCount - FPrevCount) / (Tick -
> FPrevTick); 


Hello Vladimir,

Many thanks for this, I just checked in your fix in both SVN repos,
v7 and v8. So next daily snapshots will include your fix.

-- 
Arno

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] BUG REPORT: Division by zero

2012-10-15 Thread Vladimir Kudelin
Hi,

In my application I occasionally get the EDivByZero exception
in OverbyteIcsMultipartHttpDownloader.pas (line 706):
FCurSpeed:= 8 * (FTotalCount - FPrevCount) / (Tick - FPrevTick);

Because of I'm using TMultipartHttpDownloader in threads, it's pretty
difficult to catch the exception, and the execution simply fails.

Therefore, I had to apply the following fix:

if Tick = FPrevTick then
FCurSpeed := 0
else
FCurSpeed := 8 * (FTotalCount - FPrevCount) / (Tick - FPrevTick);

Everything works fine now, but I'd prefer the fix to be included in the ICS
trunk.

Please, review and check it in, if possible.

Thanks in advance,

Vladimir Kudlein
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be