Skip to content

Commit

Permalink
Merge pull request #231 from alex-dubchak/main
Browse files Browse the repository at this point in the history
fix: re-implement sslStream initialization for framework versions < 5.0
  • Loading branch information
cnblogs-dudu authored Sep 2, 2024
2 parents 9dd3b7b + 05112f9 commit 99eabb9
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/Enyim.Caching/Memcached/PooledSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,21 @@ void Cancel()

if (success)
{
#if NET5_0_OR_GREATER
if (_useSslStream)
{
_sslStream = new SslStream(new NetworkStream(_socket));
_sslStream.AuthenticateAsClient(_sslClientAuthOptions);
_sslStream.AuthenticateAsClient(
#if NET5_0_OR_GREATER
_sslClientAuthOptions
#else
((DnsEndPoint)_endpoint).Host
#endif
);
}
else
{
_inputStream = new NetworkStream(_socket);
}
#else
_inputStream = new NetworkStream(_socket);
#endif
}
else
{
Expand Down Expand Up @@ -182,19 +184,21 @@ public async Task ConnectAsync()

if (success)
{
#if NET5_0_OR_GREATER
if (_useSslStream)
{
_sslStream = new SslStream(new NetworkStream(_socket));
await _sslStream.AuthenticateAsClientAsync(_sslClientAuthOptions);
await _sslStream.AuthenticateAsClientAsync(
#if NET5_0_OR_GREATER
_sslClientAuthOptions
#else
((DnsEndPoint)_endpoint).Host
#endif
);
}
else
{
_inputStream = new NetworkStream(_socket);
}
#else
_inputStream = new NetworkStream(_socket);
#endif
}
else
{
Expand Down

0 comments on commit 99eabb9

Please sign in to comment.