forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TCPKeepAlive to SqlClient Sockets (dotnet/corefx#33024)
* Updating version files * Enable keep alive on SqlClient TCP sockets * make KeepAlive netcoreapp specific * added condition for uapassembly * added a new defineConstants called FEATURE_TCPKEEPALIVE * update TCPKeepAliveInterval value * set KeepAlive values in unix only * add documentation and add link to Github Issue * move SNITcpHandle.Windows.cs available in UAP * updating csproj for SNITcpHandle * fix in csproj for CI failure Commit migrated from dotnet/corefx@0db2274
- Loading branch information
1 parent
40bb0fa
commit a64e7fe
Showing
4 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/libraries/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNITcpHandle.Unix.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Net.Sockets; | ||
using System.Text; | ||
|
||
namespace System.Data.SqlClient.SNI | ||
{ | ||
internal partial class SNITcpHandle | ||
{ | ||
internal static void SetKeepAliveValues(ref Socket socket) | ||
{ | ||
#if FEATURE_TCPKEEPALIVE | ||
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true); | ||
socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveInterval, 1); | ||
socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveTime, 30); | ||
#endif | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/libraries/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNITcpHandle.Windows.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Net.Sockets; | ||
using System.Text; | ||
|
||
namespace System.Data.SqlClient.SNI | ||
{ | ||
internal partial class SNITcpHandle | ||
{ | ||
internal static void SetKeepAliveValues(ref Socket socket) | ||
{ | ||
//This method will later be setting the KeepAlive, TcpKeepAliveInterval and TcpKeepAliveTime based on Windows platform specific checks. | ||
// Link to issue: https://github.com/dotnet/corefx/issues/33209 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters