Commit ee12f613 authored by Nick Craver's avatar Nick Craver

Merge branch 'craver/mono-support'

parents fbc5d33c e6d810c4
......@@ -194,13 +194,7 @@ internal void OnErrorMessage(EndPoint endpoint, string message)
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times")]
private static void Write<T>(ZipArchive zip, string name, Task task, Action<T, StreamWriter> callback)
{
var entry = zip.CreateEntry(name,
#if __MonoCS__
CompressionLevel.Fastest
#else
CompressionLevel.Optimal
#endif
);
var entry = zip.CreateEntry(name, CompressionLevel.Optimal);
using (var stream = entry.Open())
using (var writer = new StreamWriter(stream))
{
......
......@@ -740,11 +740,8 @@ SocketMode ISocketCallback.Connected(Stream stream, TextWriter log)
if (string.IsNullOrWhiteSpace(host)) host = Format.ToStringHostOnly(Bridge.ServerEndPoint.EndPoint);
var ssl = new SslStream(stream, false, config.CertificateValidationCallback,
config.CertificateSelectionCallback ?? GetAmbientCertificateCallback()
#if !__MonoCS__
, EncryptionPolicy.RequireEncryption
#endif
);
config.CertificateSelectionCallback ?? GetAmbientCertificateCallback(),
EncryptionPolicy.RequireEncryption);
try
{
ssl.AuthenticateAsClient(host, config.SslProtocols);
......
using System;
namespace StackExchange.Redis
{
internal class PlatformHelper
{
public static bool IsMono { get; } = Type.GetType("Mono.Runtime") != null;
public static bool IsUnix { get; } = (int)Environment.OSVersion.Platform == 4
|| (int)Environment.OSVersion.Platform == 6
|| (int)Environment.OSVersion.Platform == 128;
public static SocketMode DefaultSocketMode = IsMono && IsUnix ? SocketMode.Async : SocketMode.Poll;
}
}
......@@ -10,7 +10,7 @@ namespace StackExchange.Redis
{
public partial class SocketManager
{
internal const SocketMode DefaultSocketMode = SocketMode.Poll;
internal static SocketMode DefaultSocketMode = PlatformHelper.DefaultSocketMode;
private static readonly IntPtr[] EmptyPointers = new IntPtr[0];
private static readonly WaitCallback HelpProcessItems = state =>
{
......@@ -429,4 +429,4 @@ internal void Pulse()
}
}
}
#endif
\ No newline at end of file
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment