Skip to content

Commit 877e95b

Browse files
committed
Improve reading NetworkStream
1 parent ea4ccc0 commit 877e95b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Enyim.Caching/Memcached/PooledSocket.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ public async Task ReadAsync(byte[] buffer, int offset, int count)
295295
try
296296
{
297297
int currentRead = await _inputStream.ReadAsync(buffer, offset, shouldRead);
298-
if (currentRead < 1)
298+
if (currentRead == count || currentRead < 1)
299299
break;
300300

301301
read += currentRead;
@@ -333,7 +333,7 @@ public void Read(byte[] buffer, int offset, int count)
333333
try
334334
{
335335
int currentRead = _inputStream.Read(buffer, offset, shouldRead);
336-
if (currentRead < 1)
336+
if (currentRead == count || currentRead < 1)
337337
break;
338338

339339
read += currentRead;

0 commit comments

Comments
 (0)