Skip to content

Commit d38be8b

Browse files
committed
Make test for timeout more stringent. Fixes #628
1 parent 48179bf commit d38be8b

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
@@ -1,5 +1,6 @@
11
using System;
22
using System.IO;
3+
using System.Net.Sockets;
34
using System.Threading;
45
using System.Threading.Tasks;
56
using MySql.Data.MySqlClient;
@@ -38,7 +39,7 @@ ValueTask<int> DoReadBytesSync(ArraySegment<byte> buffer_)
3839
}
3940
catch (Exception ex)
4041
{
41-
if (ex is IOException && RemainingTimeout != Constants.InfiniteTimeout)
42+
if (RemainingTimeout != Constants.InfiniteTimeout && ex is IOException ioException && ioException.InnerException is SocketException socketException && socketException.SocketErrorCode == SocketError.TimedOut)
4243
return ValueTaskExtensions.FromException<int>(MySqlException.CreateForTimeout(ex));
4344
return ValueTaskExtensions.FromException<int>(ex);
4445
}

0 commit comments

Comments
 (0)