Commit e46c73d5 authored by Marc Gravell's avatar Marc Gravell

More net40 tweaks

parent ad9501d5
...@@ -276,6 +276,7 @@ internal bool HasDnsEndPoints() ...@@ -276,6 +276,7 @@ internal bool HasDnsEndPoints()
return false; return false;
} }
#pragma warning disable 1998 // NET40 is sync, not async, currently
internal async Task ResolveEndPointsAsync(ConnectionMultiplexer multiplexer, TextWriter log) internal async Task ResolveEndPointsAsync(ConnectionMultiplexer multiplexer, TextWriter log)
{ {
Dictionary<string, IPAddress> cache = new Dictionary<string, IPAddress>(StringComparer.InvariantCultureIgnoreCase); Dictionary<string, IPAddress> cache = new Dictionary<string, IPAddress>(StringComparer.InvariantCultureIgnoreCase);
...@@ -320,7 +321,7 @@ internal async Task ResolveEndPointsAsync(ConnectionMultiplexer multiplexer, Tex ...@@ -320,7 +321,7 @@ internal async Task ResolveEndPointsAsync(ConnectionMultiplexer multiplexer, Tex
} }
} }
} }
#pragma warning restore 1998
static void Append(StringBuilder sb, object value) static void Append(StringBuilder sb, object value)
{ {
if (value == null) return; if (value == null) return;
......
...@@ -9,9 +9,10 @@ ...@@ -9,9 +9,10 @@
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Runtime.CompilerServices;
#if NET40 #if NET40
using Microsoft.Runtime.CompilerServices; using Microsoft.Runtime.CompilerServices;
#else
using System.Runtime.CompilerServices;
#endif #endif
namespace StackExchange.Redis namespace StackExchange.Redis
...@@ -95,7 +96,7 @@ internal void OnConnectionFailed(EndPoint endpoint, ConnectionType connectionTyp ...@@ -95,7 +96,7 @@ internal void OnConnectionFailed(EndPoint endpoint, ConnectionType connectionTyp
ReconfigureIfNeeded(endpoint, false, "connection failed"); ReconfigureIfNeeded(endpoint, false, "connection failed");
} }
} }
internal void OnInternalError(Exception exception, EndPoint endpoint = null, ConnectionType connectionType = ConnectionType.None, [CallerMemberName] string origin = null) internal void OnInternalError(Exception exception, EndPoint endpoint = null, ConnectionType connectionType = ConnectionType.None, [System.Runtime.CompilerServices.CallerMemberName] string origin = null)
{ {
try try
{ {
...@@ -930,12 +931,12 @@ public IServer GetServer(EndPoint endpoint, object asyncState = null) ...@@ -930,12 +931,12 @@ public IServer GetServer(EndPoint endpoint, object asyncState = null)
[Conditional("VERBOSE")] [Conditional("VERBOSE")]
internal void Trace(string message, [CallerMemberName] string category = null) internal void Trace(string message, [System.Runtime.CompilerServices.CallerMemberName] string category = null)
{ {
OnTrace(message, category); OnTrace(message, category);
} }
[Conditional("VERBOSE")] [Conditional("VERBOSE")]
internal void Trace(bool condition, string message, [CallerMemberName] string category = null) internal void Trace(bool condition, string message, [System.Runtime.CompilerServices.CallerMemberName] string category = null)
{ {
if (condition) OnTrace(message, category); if (condition) OnTrace(message, category);
} }
...@@ -944,12 +945,12 @@ internal void Trace(bool condition, string message, [CallerMemberName] string ca ...@@ -944,12 +945,12 @@ internal void Trace(bool condition, string message, [CallerMemberName] string ca
static partial void OnTraceWithoutContext(string message, string category); static partial void OnTraceWithoutContext(string message, string category);
[Conditional("VERBOSE")] [Conditional("VERBOSE")]
internal static void TraceWithoutContext(string message, [CallerMemberName] string category = null) internal static void TraceWithoutContext(string message, [System.Runtime.CompilerServices.CallerMemberName] string category = null)
{ {
OnTraceWithoutContext(message, category); OnTraceWithoutContext(message, category);
} }
[Conditional("VERBOSE")] [Conditional("VERBOSE")]
internal static void TraceWithoutContext(bool condition, string message, [CallerMemberName] string category = null) internal static void TraceWithoutContext(bool condition, string message, [System.Runtime.CompilerServices.CallerMemberName] string category = null)
{ {
if(condition) OnTraceWithoutContext(message, category); if(condition) OnTraceWithoutContext(message, category);
} }
...@@ -1302,7 +1303,7 @@ internal async Task<bool> ReconfigureAsync(bool first, bool reconfigureAll, Text ...@@ -1302,7 +1303,7 @@ internal async Task<bool> ReconfigureAsync(bool first, bool reconfigureAll, Text
} }
} }
partial void OnTraceLog(TextWriter log, [CallerMemberName] string caller = null); partial void OnTraceLog(TextWriter log, [System.Runtime.CompilerServices.CallerMemberName] string caller = null);
private async Task<ServerEndPoint> NominatePreferredMaster(TextWriter log, ServerEndPoint[] servers, bool useTieBreakers, Task<string>[] tieBreakers, List<ServerEndPoint> masters) private async Task<ServerEndPoint> NominatePreferredMaster(TextWriter log, ServerEndPoint[] servers, bool useTieBreakers, Task<string>[] tieBreakers, List<ServerEndPoint> masters)
{ {
Dictionary<string, int> uniques = null; Dictionary<string, int> uniques = null;
......
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