Fixed issue where mac connections would not time out as expected (#81)

* Fixed issue where mac connections would not time out as expected

* Made check specific to OSX

* Added check for linux
This commit is contained in:
Mitchell Sternke
2016-10-10 17:14:24 -07:00
committed by GitHub
parent a3089978e1
commit 8511f5db43

View File

@@ -6,6 +6,7 @@
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Runtime.InteropServices;
using Microsoft.SqlTools.ServiceLayer.Utility;
namespace Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection
@@ -215,6 +216,11 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection
public static bool IsRetryableNetworkConnectivityError(int errorNumber)
{
// .NET core has a bug on OSX/Linux that makes this error number always zero (issue 12472)
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return errorNumber != 0 && _retryableNetworkConnectivityErrors.Contains(errorNumber);
}
return _retryableNetworkConnectivityErrors.Contains(errorNumber);
}