Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit f007c2f

Browse files
committed
Respect ConnectTimeout when in netstandard2
We were doing some testing of ServiceStack.Redis and noticed that the connect timeout is not working and would block when running on dotnetcore. I believe the conditional that was there was needed when we the project was targetting netstandard1.3 but now with 2.0 that whole conditional is not needed and now the timeout is being respected after this change.
1 parent 57a1e6e commit f007c2f

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

src/ServiceStack.Redis/RedisNativeClient_Utils.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,6 @@ private void Connect()
9292
};
9393
try
9494
{
95-
#if NETSTANDARD2_0
96-
if (IPAddress.TryParse(Host, out var ip))
97-
{
98-
socket.Connect(ip, Port);
99-
}
100-
else
101-
{
102-
var addresses = Dns.GetHostAddressesAsync(Host).Result;
103-
socket.Connect(addresses.FirstOrDefault(a => a.AddressFamily == AddressFamily.InterNetwork), Port);
104-
}
105-
#else
10695
if (ConnectTimeout <= 0)
10796
{
10897
socket.Connect(Host, Port);
@@ -114,7 +103,6 @@ private void Connect()
114103
: socket.BeginConnect(Host, Port, null, null);
115104
connectResult.AsyncWaitHandle.WaitOne(ConnectTimeout, true);
116105
}
117-
#endif
118106

119107
if (!socket.Connected)
120108
{

0 commit comments

Comments
 (0)