Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit ead6bfa

Browse files
committed
Clean up NETSTANDARD1_3 defs
1 parent d9594a3 commit ead6bfa

11 files changed

+52
-104
lines changed

lib/netcore/ServiceStack.Common.deps.json

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"runtimeTarget": {
33
"name": ".NETStandard,Version=v1.3/",
4-
"signature": "db0d62b381ef8d172828ceea48ef22a5bb733309"
4+
"signature": "f6bdf0627409bf8c8c34a3f2bff1c384ea00737d"
55
},
66
"compilationOptions": {},
77
"targets": {
@@ -14,6 +14,7 @@
1414
"System.ComponentModel.Primitives": "4.1.0",
1515
"System.Net.Primitives": "4.0.11",
1616
"System.Net.NetworkInformation": "4.1.0",
17+
"System.Net.Security": "4.0.0",
1718
"NETStandard.Library": "1.6.0",
1819
"ServiceStack.Interfaces": "1.0.0",
1920
"ServiceStack.Text": "1.0.0"
@@ -383,6 +384,31 @@
383384
"System.Runtime.Handles": "4.0.1"
384385
}
385386
},
387+
"System.Net.Security/4.0.0": {
388+
"dependencies": {
389+
"Microsoft.NETCore.Platforms": "1.0.1",
390+
"Microsoft.Win32.Primitives": "4.0.1",
391+
"System.Collections": "4.0.11",
392+
"System.Collections.Concurrent": "4.0.12",
393+
"System.Diagnostics.Tracing": "4.1.0",
394+
"System.Globalization": "4.0.11",
395+
"System.IO": "4.1.0",
396+
"System.Net.Primitives": "4.0.11",
397+
"System.Resources.ResourceManager": "4.0.1",
398+
"System.Runtime": "4.1.0",
399+
"System.Runtime.Extensions": "4.1.0",
400+
"System.Runtime.Handles": "4.0.1",
401+
"System.Runtime.InteropServices": "4.1.0",
402+
"System.Security.Claims": "4.0.1",
403+
"System.Security.Cryptography.Primitives": "4.0.0",
404+
"System.Security.Cryptography.X509Certificates": "4.1.0",
405+
"System.Security.Principal": "4.0.1",
406+
"System.Security.Principal.Windows": "4.0.0",
407+
"System.Threading": "4.0.11",
408+
"System.Threading.Tasks": "4.0.11",
409+
"System.Threading.ThreadPool": "4.0.10"
410+
}
411+
},
386412
"System.Net.Sockets/4.1.0": {
387413
"dependencies": {
388414
"Microsoft.NETCore.Platforms": "1.0.1",
@@ -917,6 +943,11 @@
917943
"serviceable": true,
918944
"sha512": "sha512-tl/51pHaQVIMdpeuDx+s5IzfxluITA9ZWcBESpukkM70qKnMFRHcDae20oqW9rruJd60R56iuKjLn/ftua/UxQ=="
919945
},
946+
"System.Net.Security/4.0.0": {
947+
"type": "package",
948+
"serviceable": true,
949+
"sha512": "sha512-NtWq5sp36hLdAEPlHq/NQaOtYEywSReOLg5P/SI9Q1wRuGIZhyBXuRni1rFQwoDLxa0qZfbsbApYck8Nadl3wA=="
950+
},
920951
"System.Net.Sockets/4.1.0": {
921952
"type": "package",
922953
"serviceable": true,

lib/netcore/ServiceStack.Common.dll

512 Bytes
Binary file not shown.

lib/netcore/ServiceStack.Common.pdb

0 Bytes
Binary file not shown.

lib/netcore/ServiceStack.Text.dll

0 Bytes
Binary file not shown.

lib/netcore/ServiceStack.Text.pdb

0 Bytes
Binary file not shown.

src/ServiceStack.Redis/BufferedStream.cs

Lines changed: 11 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -10,80 +10,35 @@ public sealed class BufferedStream : Stream
1010
NetworkStream networkStream;
1111

1212
public BufferedStream(Stream stream)
13-
: this(stream, 0)
14-
{
15-
}
13+
: this(stream, 0) {}
1614

1715
public BufferedStream(Stream stream, int bufferSize)
1816
{
19-
networkStream = stream as NetworkStream;
20-
21-
if (networkStream == null)
22-
throw new ArgumentNullException("stream");
23-
}
24-
25-
26-
/* public BufferedStream(Stream stream)
27-
: this(stream, 0)
28-
{
17+
networkStream = (NetworkStream)stream;
2918
}
19+
public override bool CanRead => networkStream.CanRead;
3020

31-
public BufferedStream(Stream stream, int bufferSize) : base (stream)
32-
{
33-
if (stream == null)
34-
throw new ArgumentNullException("stream");
35-
}
36-
*/
37-
public override bool CanRead
38-
{
39-
get { return networkStream.CanRead; }
40-
}
41-
42-
public override bool CanSeek
43-
{
44-
get { return networkStream.CanSeek; }
45-
}
21+
public override bool CanSeek => networkStream.CanSeek;
4622

47-
public override bool CanWrite
48-
{
49-
get { return networkStream.CanWrite; }
50-
}
23+
public override bool CanWrite => networkStream.CanWrite;
5124

5225
public override long Position
5326
{
5427
get { return networkStream.Position; }
5528
set { networkStream.Position = value; }
5629
}
5730

58-
public override long Length
59-
{
60-
get { return networkStream.Length; }
61-
}
31+
public override long Length => networkStream.Length;
6232

63-
public override int Read(byte[] buffer, int offset, int length)
64-
{
65-
return networkStream.Read(buffer, offset, length);
66-
}
33+
public override int Read(byte[] buffer, int offset, int length) => networkStream.Read(buffer, offset, length);
6734

68-
public override void Write(byte[] buffer, int offset, int length)
69-
{
70-
networkStream.Write(buffer, offset, length);
71-
}
35+
public override void Write(byte[] buffer, int offset, int length) => networkStream.Write(buffer, offset, length);
7236

73-
public override void Flush()
74-
{
75-
networkStream.Flush();
76-
}
37+
public override void Flush() => networkStream.Flush();
7738

78-
public override void SetLength(long length)
79-
{
80-
networkStream.SetLength(length);
81-
}
39+
public override void SetLength(long length) => networkStream.SetLength(length);
8240

83-
public override long Seek(long position, SeekOrigin origin)
84-
{
85-
return networkStream.Seek(position, origin);
86-
}
41+
public override long Seek(long position, SeekOrigin origin) => networkStream.Seek(position, origin);
8742
}
8843
}
8944
#endif

src/ServiceStack.Redis/RedisNativeClient_Utils.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -590,11 +590,7 @@ protected T SendReceive<T>(byte[][] cmdWithBinaryArgs,
590590
}
591591

592592
Interlocked.Increment(ref RedisState.TotalRetryCount);
593-
#if NETSTANDARD1_3
594-
Task.Delay(GetBackOffMultiplier(++i)).Wait();
595-
#else
596-
Thread.Sleep(GetBackOffMultiplier(++i));
597-
#endif
593+
TaskUtils.Sleep(GetBackOffMultiplier(++i));
598594
}
599595
}
600596
}
@@ -1262,13 +1258,7 @@ public string CalculateSha1(string luaBody)
12621258
throw new ArgumentNullException("luaBody");
12631259

12641260
byte[] buffer = Encoding.UTF8.GetBytes(luaBody);
1265-
#if NETSTANDARD1_3
1266-
var sha1 = SHA1.Create();
1267-
return BitConverter.ToString(sha1.ComputeHash(buffer)).Replace("-", "");
1268-
#else
1269-
var cryptoTransformSHA1 = new SHA1CryptoServiceProvider();
1270-
return BitConverter.ToString(cryptoTransformSHA1.ComputeHash(buffer)).Replace("-", "");
1271-
#endif
1261+
return BitConverter.ToString(buffer.ToSha1Hash()).Replace("-", "");
12721262
}
12731263

12741264
public byte[] ScriptLoad(string luaBody)

src/ServiceStack.Redis/RedisPubSubServer.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,7 @@ private void RunLoop()
336336
if (AutoRestart && Interlocked.CompareExchange(ref status, 0, 0) != Status.Disposed)
337337
{
338338
if (WaitBeforeNextRestart != null)
339-
#if NETSTANDARD1_3
340-
Task.Delay(WaitBeforeNextRestart.Value).Wait();
341-
#else
342-
Thread.Sleep(WaitBeforeNextRestart.Value);
343-
#endif
339+
TaskUtils.Sleep(WaitBeforeNextRestart.Value);
344340
Start();
345341
}
346342
}
@@ -477,11 +473,7 @@ private void SleepBackOffMultiplier(int continuousErrorsCount)
477473
if (Log.IsDebugEnabled)
478474
Log.Debug("Sleeping for {0}ms after {1} continuous errors".Fmt(nextTry, continuousErrorsCount));
479475

480-
#if NETSTANDARD1_3
481-
Task.Delay(nextTry).Wait();
482-
#else
483-
Thread.Sleep(nextTry);
484-
#endif
476+
TaskUtils.Sleep(nextTry);
485477
}
486478

487479
public static class Operation //dep-free copy of WorkerOperation

src/ServiceStack.Redis/RedisSentinel.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,7 @@ private RedisSentinelWorker GetValidSentinelWorker()
331331
}
332332

333333
this.failures = 0; //reset
334-
#if NETSTANDARD1_3
335-
Task.Delay(WaitBetweenFailedHosts).Wait();
336-
#else
337-
Thread.Sleep(WaitBetweenFailedHosts);
338-
#endif
334+
TaskUtils.Sleep(WaitBetweenFailedHosts);
339335
throw new RedisException("No Redis Sentinels were available", lastEx);
340336
}
341337

src/ServiceStack.Redis/RedisSentinelResolver.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,7 @@ public virtual RedisClient CreateRedisClient(RedisEndpoint config, bool master)
151151
Interlocked.Increment(ref RedisState.TotalForcedMasterFailovers);
152152

153153
sentinel.ForceMasterFailover();
154-
#if NETSTANDARD1_3
155-
Task.Delay(sentinel.WaitBetweenFailedHosts).Wait();
156-
#else
157-
Thread.Sleep(sentinel.WaitBetweenFailedHosts);
158-
#endif
154+
TaskUtils.Sleep(sentinel.WaitBetweenFailedHosts);
159155
role = client.GetServerRole();
160156
}
161157
}
@@ -196,11 +192,7 @@ public virtual RedisClient CreateRedisClient(RedisEndpoint config, bool master)
196192
throw new TimeoutException("Max Wait Between Sentinel Lookups Elapsed: {0}"
197193
.Fmt(sentinel.MaxWaitBetweenFailedHosts.ToString()));
198194

199-
#if NETSTANDARD1_3
200-
Task.Delay(sentinel.WaitBetweenFailedHosts);
201-
#else
202-
Thread.Sleep(sentinel.WaitBetweenFailedHosts);
203-
#endif
195+
TaskUtils.Sleep(sentinel.WaitBetweenFailedHosts);
204196
}
205197
}
206198
catch (Exception ex)

0 commit comments

Comments
 (0)