Skip to content

Commit 77479f0

Browse files
committed
Disallow negative RemainingTimeout. Fixes #1424
1 parent 5611920 commit 77479f0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/MySqlConnector/Protocol/Serialization/StreamByteHandler.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ public StreamByteHandler(Stream stream)
1818

1919
public ValueTask<int> ReadBytesAsync(Memory<byte> buffer, IOBehavior ioBehavior)
2020
{
21-
return ioBehavior == IOBehavior.Asynchronous ? new ValueTask<int>(DoReadBytesAsync(buffer)) :
21+
return
2222
RemainingTimeout <= 0 ? ValueTaskExtensions.FromException<int>(MySqlException.CreateForTimeout()) :
23+
ioBehavior == IOBehavior.Asynchronous ? new ValueTask<int>(DoReadBytesAsync(buffer)) :
2324
m_stream.CanTimeout ? DoReadBytesSync(buffer) :
2425
DoReadBytesSyncOverAsync(buffer);
2526

0 commit comments

Comments
 (0)