- Added protection against zero division.

git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@182 5dc33758-31d5-4daf-9ae8-b24bf3d40d73
This commit is contained in:
Frank Voorburg 2016-11-15 08:49:56 +00:00
parent d677bf4bfd
commit fcb25f5dc8
2 changed files with 22 additions and 21 deletions

View File

@ -247,13 +247,13 @@ begin
rxCnt := 0;
packetLen := 0;
// only attempt to receive the remainder of the packet if its length is valid
if resLen > 0 then
begin
// re-confgure the reception timeout now that the total packet length is known.
// timeout = (MULTIPLIER) * number_of_bytes + CONSTANT
sciDriver.Timeouts.ReadTotalConstant := 0;
if timeOutms > 0 then
sciDriver.Timeouts.ReadTotalMultiplier := timeOutms div resLen
else
sciDriver.Timeouts.ReadTotalMultiplier := timeOutms;
sciDriver.Timeouts.ReadTotalMultiplier := timeOutms div resLen;
// attempt to receive the bytes of the response packet one by one
while (rxCnt < resLen) and (GetTickCount < dwEnd) do
@ -274,6 +274,7 @@ begin
result := true;
end;
end;
end;
end; //*** end of SendPacket ***

Binary file not shown.