Skip to content

Commit

Permalink
Исправление EvilBeaver#1471. Добавлено прерывание цикла считывания пр…
Browse files Browse the repository at this point in the history
…и использовании и достижении заданного лимита
  • Loading branch information
akpaevj committed Dec 6, 2024
1 parent 0aea6cd commit 049247d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/OneScript.StandardLibrary/Net/TCPClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ private MemoryStream ReadAllData(NetworkStream source, int limit)
int numberOfBytesRead = source.Read(readBuffer, 0, portion);
ms.Write(readBuffer, 0, numberOfBytesRead);
if (useLimit)
limit -= numberOfBytesRead;
{
limit -= numberOfBytesRead;
if (limit <= 0)
break;
}
} while (source.DataAvailable);

if(ms.Length > 0)
Expand Down

0 comments on commit 049247d

Please sign in to comment.