Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
17e82256
Commit
17e82256
authored
Nov 04, 2015
by
Jeremy Meng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use DNXCORE50 constant instead of NETCORE. Socket is only supported on dnxcore.
parent
d694d922
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
45 additions
and
47 deletions
+45
-47
BasicOps.cs
StackExchange.Redis.Tests/BasicOps.cs
+5
-2
Cluster.cs
StackExchange.Redis.Tests/Cluster.cs
+1
-1
Config.cs
StackExchange.Redis.Tests/Config.cs
+1
-1
SO25567566.cs
StackExchange.Redis.Tests/Issues/SO25567566.cs
+1
-1
Naming.cs
StackExchange.Redis.Tests/Naming.cs
+4
-4
Profiling.cs
StackExchange.Redis.Tests/Profiling.cs
+1
-1
PubSub.cs
StackExchange.Redis.Tests/PubSub.cs
+1
-1
TestBase.cs
StackExchange.Redis.Tests/TestBase.cs
+1
-1
project.json
...is.Tests_dnxcore50/StackExchange.Redis.Tests/project.json
+0
-1
VolatileWrapper.cs
...hange.Redis/StackExchange/Redis/Compat/VolatileWrapper.cs
+2
-2
ConfigurationOptions.cs
...xchange.Redis/StackExchange/Redis/ConfigurationOptions.cs
+4
-4
ConnectionMultiplexer.cs
...change.Redis/StackExchange/Redis/ConnectionMultiplexer.cs
+10
-10
HashEntry.cs
StackExchange.Redis/StackExchange/Redis/HashEntry.cs
+1
-1
InternalRegexCompiledOption.cs
....Redis/StackExchange/Redis/InternalRegexCompiledOption.cs
+2
-2
RedisValue.cs
StackExchange.Redis/StackExchange/Redis/RedisValue.cs
+1
-1
ScriptParameterMapper.cs
...change.Redis/StackExchange/Redis/ScriptParameterMapper.cs
+3
-3
SocketManager.NoPoll.cs
...xchange.Redis/StackExchange/Redis/SocketManager.NoPoll.cs
+1
-1
SocketManager.Poll.cs
...kExchange.Redis/StackExchange/Redis/SocketManager.Poll.cs
+1
-5
SocketManager.cs
StackExchange.Redis/StackExchange/Redis/SocketManager.cs
+3
-3
SortedSetEntry.cs
StackExchange.Redis/StackExchange/Redis/SortedSetEntry.cs
+2
-2
No files found.
StackExchange.Redis.Tests/BasicOps.cs
View file @
17e82256
...
...
@@ -239,7 +239,7 @@ public void MassiveBulkOpsAsync(bool preserveOrder, bool withContinuation)
Action
<
Task
>
nonTrivial
=
delegate
{
#if !
NETCORE
#if !
DNXCORE50
Thread
.
SpinWait
(
5
);
#else
var
spinWait
=
new
SpinWait
();
...
...
@@ -488,14 +488,17 @@ public void MassiveBulkOpsSyncOldStyle(ResultCompletionMode completionMode, int
}
#endif
//TODO: Ignore("dnxcore crash")
#if !DNXCORE50
[
Test
]
[
TestCase
(
true
,
1
)]
[
TestCase
(
false
,
1
)]
[
TestCase
(
true
,
5
)]
[
TestCase
(
false
,
5
)]
#endif
public
void
MassiveBulkOpsFireAndForget
(
bool
preserveOrder
,
int
threads
)
{
using
(
var
muxer
=
Create
())
using
(
var
muxer
=
Create
(
syncTimeout
:
20000
))
{
muxer
.
PreserveAsyncOrder
=
preserveOrder
;
#if DEBUG
...
...
StackExchange.Redis.Tests/Cluster.cs
View file @
17e82256
...
...
@@ -20,7 +20,7 @@ public class Cluster : TestBase
protected
override
string
GetConfiguration
()
{
var
server
=
ClusterIp
;
#if !
NETCORE
#if !
DNXCORE50
if
(
string
.
Equals
(
Environment
.
MachineName
,
"MARC-LAPTOP"
,
StringComparison
.
InvariantCultureIgnoreCase
))
#else
if
(
string
.
Equals
(
Environment
.
GetEnvironmentVariable
(
"COMPUTERNAME"
),
"MARC-LAPTOP"
,
StringComparison
.
OrdinalIgnoreCase
))
...
...
StackExchange.Redis.Tests/Config.cs
View file @
17e82256
...
...
@@ -144,7 +144,7 @@ public void ReadConfig()
var
all
=
conn
.
ConfigGet
();
Assert
.
IsTrue
(
all
.
Length
>
0
,
"any"
);
#if !
NETCORE
#if !
DNXCORE50
var
pairs
=
all
.
ToDictionary
(
x
=>
(
string
)
x
.
Key
,
x
=>
(
string
)
x
.
Value
,
StringComparer
.
InvariantCultureIgnoreCase
);
#else
var
pairs
=
all
.
ToDictionary
(
x
=>
(
string
)
x
.
Key
,
x
=>
(
string
)
x
.
Value
,
StringComparer
.
OrdinalIgnoreCase
);
...
...
StackExchange.Redis.Tests/Issues/SO25567566.cs
View file @
17e82256
...
...
@@ -9,7 +9,7 @@ public class SO25567566 : TestBase
{
protected
override
string
GetConfiguration
()
{
return
"127.0.0.1"
;
return
"127.0.0.1
:6379
"
;
}
[
Test
]
public
async
void
Execute
()
...
...
StackExchange.Redis.Tests/Naming.cs
View file @
17e82256
...
...
@@ -150,7 +150,7 @@ public void CheckSyncAsyncMethodsMatch(Type from, Type to)
var
pFrom
=
method
.
GetParameters
();
Type
[]
args
=
pFrom
.
Select
(
x
=>
x
.
ParameterType
).
ToArray
();
Assert
.
AreEqual
(
typeof
(
CommandFlags
),
args
.
Last
());
#if !
NETCORE
#if !
DNXCORE50
var
found
=
to
.
GetMethod
(
huntName
,
flags
,
null
,
method
.
CallingConvention
,
args
,
null
);
#else
var
found
=
to
.
GetMethods
(
flags
)
...
...
@@ -176,14 +176,14 @@ void CheckMethod(MethodInfo method, bool isAsync)
{
#if DEBUG
#if !
NETCORE
#if !
DNXCORE50
bool
ignorePrefix
=
ignoreType
!=
null
&&
Attribute
.
IsDefined
(
method
,
ignoreType
);
#else
bool
ignorePrefix
=
ignoreType
!=
null
&&
method
.
IsDefined
(
ignoreType
);
#endif
if
(
ignorePrefix
)
{
#if !
NETCORE
#if !
DNXCORE50
Attribute
attrib
=
Attribute
.
GetCustomAttribute
(
method
,
ignoreType
);
#else
Attribute
attrib
=
method
.
GetCustomAttribute
(
ignoreType
);
...
...
@@ -228,7 +228,7 @@ void CheckName(MemberInfo member, bool isAsync)
public
static
class
ReflectionExtensions
{
#if !
NETCORE
#if !
DNXCORE50
public
static
Type
GetTypeInfo
(
this
Type
type
)
{
return
type
;
...
...
StackExchange.Redis.Tests/Profiling.cs
View file @
17e82256
...
...
@@ -2,7 +2,7 @@
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
#if
NETCORE
#if
DNXCORE50
using
System.Reflection
;
#endif
using
System.Threading.Tasks
;
...
...
StackExchange.Redis.Tests/PubSub.cs
View file @
17e82256
...
...
@@ -417,7 +417,7 @@ internal static class VolatileWrapper
{
public
static
int
Read
(
ref
int
location
)
{
#if !
NETCORE
#if !
DNXCORE50
return
Thread
.
VolatileRead
(
ref
location
);
#else
return
Volatile
.
Read
(
ref
location
);
...
...
StackExchange.Redis.Tests/TestBase.cs
View file @
17e82256
...
...
@@ -285,7 +285,7 @@ protected static TimeSpan RunConcurrent(Action work, int threads, int timeout =
}
if
(!
allDone
.
WaitOne
(
timeout
))
{
#if !
NETCORE
#if !
DNXCORE50
for
(
int
i
=
0
;
i
<
threads
;
i
++)
{
var
thd
=
threadArr
[
i
];
...
...
StackExchange.Redis.Tests_dnxcore50/StackExchange.Redis.Tests/project.json
View file @
17e82256
...
...
@@ -21,7 +21,6 @@
"frameworks"
:
{
"dnxcore50"
:
{
"compilationOptions"
:
{
"define"
:
[
"NETCORE"
],
"warningsAsErrors"
:
false
},
"dependencies"
:
{
...
...
StackExchange.Redis/StackExchange/Redis/Compat/VolatileWrapper.cs
View file @
17e82256
...
...
@@ -10,7 +10,7 @@ internal static class VolatileWrapper
{
public
static
int
Read
(
ref
int
location
)
{
#if !
NETCORE
#if !
DNXCORE50
return
System
.
Threading
.
Thread
.
VolatileRead
(
ref
location
);
#else
return
System
.
Threading
.
Volatile
.
Read
(
ref
location
);
...
...
@@ -19,7 +19,7 @@ public static int Read(ref int location)
public
static
void
Write
(
ref
int
address
,
int
value
)
{
#if !
NETCORE
#if !
DNXCORE50
System
.
Threading
.
Thread
.
VolatileWrite
(
ref
address
,
value
);
#else
System
.
Threading
.
Volatile
.
Write
(
ref
address
,
value
);
...
...
StackExchange.Redis/StackExchange/Redis/ConfigurationOptions.cs
View file @
17e82256
...
...
@@ -30,7 +30,7 @@ public enum Proxy
/// The options relevant to a set of redis connections
/// </summary>
public
sealed
class
ConfigurationOptions
#if !
NETCORE
#if !
DNXCORE50
:
ICloneable
#endif
{
...
...
@@ -143,7 +143,7 @@ public static string TryNormalize(string value)
/// Indicates whether the connection should be encrypted
/// </summary>
[
Obsolete
(
"Please use .Ssl instead of .UseSsl"
),
#if !
NETCORE
#if !
DNXCORE50
Browsable
(
false
),
#endif
EditorBrowsable
(
EditorBrowsableState
.
Never
)]
...
...
@@ -470,7 +470,7 @@ static void Append(StringBuilder sb, string prefix, object value)
}
}
#if !
NETCORE
#if !
DNXCORE50
static
bool
IsOption
(
string
option
,
string
prefix
)
{
return
option
.
StartsWith
(
prefix
,
StringComparison
.
InvariantCultureIgnoreCase
);
...
...
@@ -492,7 +492,7 @@ void Clear()
SocketManager
=
null
;
}
#if !
NETCORE
#if !
DNXCORE50
object
ICloneable
.
Clone
()
{
return
Clone
();
}
#endif
...
...
StackExchange.Redis/StackExchange/Redis/ConnectionMultiplexer.cs
View file @
17e82256
...
...
@@ -561,7 +561,7 @@ private static bool WaitAllIgnoreErrors(Task[] tasks, int timeout)
return
false
;
}
#if !
NETCORE
#if !
DNXCORE50
private
void
LogLockedWithThreadPoolStats
(
TextWriter
log
,
string
message
,
out
int
busyWorkerCount
)
{
busyWorkerCount
=
0
;
...
...
@@ -603,7 +603,7 @@ private async Task<bool> WaitAllIgnoreErrorsAsync(Task[] tasks, int timeoutMilli
}
var
watch
=
Stopwatch
.
StartNew
();
#if !
NETCORE
#if !
DNXCORE50
int
busyWorkerCount
;
LogLockedWithThreadPoolStats
(
log
,
"Awaiting task completion"
,
out
busyWorkerCount
);
#endif
...
...
@@ -613,7 +613,7 @@ private async Task<bool> WaitAllIgnoreErrorsAsync(Task[] tasks, int timeoutMilli
var
remaining
=
timeoutMilliseconds
-
checked
((
int
)
watch
.
ElapsedMilliseconds
);
if
(
remaining
<=
0
)
{
#if !
NETCORE
#if !
DNXCORE50
LogLockedWithThreadPoolStats
(
log
,
"Timeout before awaiting for tasks"
,
out
busyWorkerCount
);
#endif
return
false
;
...
...
@@ -627,7 +627,7 @@ private async Task<bool> WaitAllIgnoreErrorsAsync(Task[] tasks, int timeoutMilli
var
any
=
Task
.
WhenAny
(
allTasks
,
Task
.
Delay
(
remaining
)).
ObserveErrors
();
#endif
bool
all
=
await
any
.
ForAwait
()
==
allTasks
;
#if !
NETCORE
#if !
DNXCORE50
LogLockedWithThreadPoolStats
(
log
,
all
?
"All tasks completed cleanly"
:
"Not all tasks completed cleanly"
,
out
busyWorkerCount
);
#endif
return
all
;
...
...
@@ -645,7 +645,7 @@ private async Task<bool> WaitAllIgnoreErrorsAsync(Task[] tasks, int timeoutMilli
var
remaining
=
timeoutMilliseconds
-
checked
((
int
)
watch
.
ElapsedMilliseconds
);
if
(
remaining
<=
0
)
{
#if !
NETCORE
#if !
DNXCORE50
LogLockedWithThreadPoolStats
(
log
,
"Timeout awaiting tasks"
,
out
busyWorkerCount
);
#endif
return
false
;
...
...
@@ -663,7 +663,7 @@ private async Task<bool> WaitAllIgnoreErrorsAsync(Task[] tasks, int timeoutMilli
{
}
}
}
#if !
NETCORE
#if !
DNXCORE50
LogLockedWithThreadPoolStats
(
log
,
"Finished awaiting tasks"
,
out
busyWorkerCount
);
#endif
return
false
;
...
...
@@ -1887,7 +1887,7 @@ internal T ExecuteSyncImpl<T>(Message message, ResultProcessor<T> processor, Ser
else
{
int
inst
,
qu
,
qs
,
qc
,
wr
,
wq
,
@in
,
ar
;
#if !__MonoCS__ && !
NETCORE
#if !__MonoCS__ && !
DNXCORE50
var
mgrState
=
socketManager
.
State
;
var
lastError
=
socketManager
.
LastErrorTimeRelative
();
...
...
@@ -1902,7 +1902,7 @@ internal T ExecuteSyncImpl<T>(Message message, ResultProcessor<T> processor, Ser
int
queue
=
server
.
GetOutstandingCount
(
message
.
Command
,
out
inst
,
out
qu
,
out
qs
,
out
qc
,
out
wr
,
out
wq
,
out
@in
,
out
ar
);
add
(
"Instantaneous"
,
"inst"
,
inst
.
ToString
());
#if !__MonoCS__ && !
NETCORE
#if !__MonoCS__ && !
DNXCORE50
add
(
"Manager-State"
,
"mgr"
,
mgrState
.
ToString
());
add
(
"Last-Error"
,
"err"
,
lastError
);
#endif
...
...
@@ -1916,7 +1916,7 @@ internal T ExecuteSyncImpl<T>(Message message, ResultProcessor<T> processor, Ser
add
(
"Active-Readers"
,
"ar"
,
ar
.
ToString
());
add
(
"Client-Name"
,
"clientName"
,
ClientName
);
#if !
NETCORE
#if !
DNXCORE50
string
iocp
,
worker
;
int
busyWorkerCount
=
GetThreadPoolStats
(
out
iocp
,
out
worker
);
add
(
"ThreadPool-IO-Completion"
,
"IOCP"
,
iocp
);
...
...
@@ -1953,7 +1953,7 @@ internal T ExecuteSyncImpl<T>(Message message, ResultProcessor<T> processor, Ser
}
}
#if !
NETCORE
#if !
DNXCORE50
private
static
int
GetThreadPoolStats
(
out
string
iocp
,
out
string
worker
)
{
//BusyThreads = TP.GetMaxThreads() –TP.GetAVailable();
...
...
StackExchange.Redis/StackExchange/Redis/HashEntry.cs
View file @
17e82256
...
...
@@ -32,7 +32,7 @@ public HashEntry(RedisValue name, RedisValue value)
/// The name of the hash field
/// </summary>
[
#if !
NETCORE
#if !
DNXCORE50
Browsable
(
false
),
#endif
EditorBrowsable
(
EditorBrowsableState
.
Never
),
Obsolete
(
"Please use Name"
,
false
)]
...
...
StackExchange.Redis/StackExchange/Redis/InternalRegexCompiledOption.cs
View file @
17e82256
#
if
NETCORE
#
if
DNXCORE50
using
System
;
#endif
using
System.Text.RegularExpressions
;
...
...
@@ -11,7 +11,7 @@ internal static class InternalRegexCompiledOption
static
InternalRegexCompiledOption
()
{
#if
NETCORE
#if
DNXCORE50
if
(!
Enum
.
TryParse
(
"Compiled"
,
out
RegexCompiledOption
))
RegexCompiledOption
=
RegexOptions
.
None
;
#else
...
...
StackExchange.Redis/StackExchange/Redis/RedisValue.cs
View file @
17e82256
...
...
@@ -306,7 +306,7 @@ public int CompareTo(RedisValue other)
if
(
otherType
==
CompareType
.
Double
)
return
thisDouble
.
CompareTo
(
otherDouble
);
}
// otherwise, compare as strings
#if !
NETCORE
#if !
DNXCORE50
return
StringComparer
.
InvariantCulture
.
Compare
((
string
)
this
,
(
string
)
other
);
#else
var
compareInfo
=
System
.
Globalization
.
CultureInfo
.
InvariantCulture
.
CompareInfo
;
...
...
StackExchange.Redis/StackExchange/Redis/ScriptParameterMapper.cs
View file @
17e82256
...
...
@@ -313,7 +313,7 @@ static void PrefixIfNeeded(ILGenerator il, LocalBuilder needsPrefixBool, ref Loc
LocalBuilder
redisKeyLoc
=
null
;
var
loc
=
il
.
DeclareLocal
(
t
);
il
.
Emit
(
OpCodes
.
Ldarg_0
);
// object
#if !
NETCORE
#if !
DNXCORE50
if
(
t
.
IsValueType
)
#else
if
(
t
.
GetTypeInfo
().
IsValueType
)
...
...
@@ -348,7 +348,7 @@ static void PrefixIfNeeded(ILGenerator il, LocalBuilder needsPrefixBool, ref Loc
{
il
.
Emit
(
OpCodes
.
Dup
);
// RedisKey[] RedisKey[]
il
.
Emit
(
OpCodes
.
Ldc_I4
,
i
);
// RedisKey[] RedisKey[] int
#if !
NETCORE
#if !
DNXCORE50
if
(
t
.
IsValueType
)
#else
if
(
t
.
GetTypeInfo
().
IsValueType
)
...
...
@@ -380,7 +380,7 @@ static void PrefixIfNeeded(ILGenerator il, LocalBuilder needsPrefixBool, ref Loc
{
il
.
Emit
(
OpCodes
.
Dup
);
// RedisKey[] RedisValue[] RedisValue[]
il
.
Emit
(
OpCodes
.
Ldc_I4
,
i
);
// RedisKey[] RedisValue[] RedisValue[] int
#if !
NETCORE
#if !
DNXCORE50
if
(
t
.
IsValueType
)
#else
if
(
t
.
GetTypeInfo
().
IsValueType
)
...
...
StackExchange.Redis/StackExchange/Redis/SocketManager.NoPoll.cs
View file @
17e82256
#
if
__MonoCS__
||
NETCORE
#
if
__MonoCS__
||
DNXCORE50
namespace
StackExchange.Redis
{
...
...
StackExchange.Redis/StackExchange/Redis/SocketManager.Poll.cs
View file @
17e82256
...
...
@@ -5,7 +5,7 @@
using
System.Runtime.InteropServices
;
using
System.Threading
;
#if !__MonoCS__ && !
NETCORE
#if !__MonoCS__ && !
DNXCORE50
namespace
StackExchange.Redis
{
...
...
@@ -376,12 +376,8 @@ private void ReadImpl()
private
void
StartReader
()
{
#if !NETCORE
var
thread
=
new
Thread
(
read
,
32
*
1024
);
// don't need a huge stack
thread
.
Priority
=
ThreadPriority
.
AboveNormal
;
// time critical
#else
var
thread
=
new
Thread
(
read
);
// don't need a huge stack
#endif
thread
.
Name
=
name
+
":Read"
;
thread
.
IsBackground
=
true
;
thread
.
Start
(
this
);
...
...
StackExchange.Redis/StackExchange/Redis/SocketManager.cs
View file @
17e82256
...
...
@@ -126,7 +126,7 @@ public SocketManager(string name = null)
// we need a dedicated writer, because when under heavy ambient load
// (a busy asp.net site, for example), workers are not reliable enough
#if !
NETCORE
#if !
DNXCORE50
Thread
dedicatedWriter
=
new
Thread
(
writeAllQueues
,
32
*
1024
);
// don't need a huge stack;
dedicatedWriter
.
Priority
=
ThreadPriority
.
AboveNormal
;
// time critical
#else
...
...
@@ -221,7 +221,7 @@ internal void SetFastLoopbackOption(Socket socket)
// SIO_LOOPBACK_FAST_PATH (http://msdn.microsoft.com/en-us/library/windows/desktop/jj841212%28v=vs.85%29.aspx)
// Speeds up localhost operations significantly. OK to apply to a socket that will not be hooked up to localhost,
// or will be subject to WFP filtering.
#if !
NETCORE
#if !
DNXCORE50
const
int
SIO_LOOPBACK_FAST_PATH
=
-
1744830448
;
// windows only
...
...
@@ -340,7 +340,7 @@ private void Shutdown(Socket socket)
{
OnShutdown
(
socket
);
try
{
socket
.
Shutdown
(
SocketShutdown
.
Both
);
}
catch
{
}
#if !
NETCORE
#if !
DNXCORE50
try
{
socket
.
Close
();
}
catch
{
}
#endif
try
{
socket
.
Dispose
();
}
catch
{
}
...
...
StackExchange.Redis/StackExchange/Redis/SortedSetEntry.cs
View file @
17e82256
...
...
@@ -33,7 +33,7 @@ public SortedSetEntry(RedisValue element, double score)
/// The score against the element
/// </summary>
[
#if !
NETCORE
#if !
DNXCORE50
Browsable
(
false
),
#endif
EditorBrowsable
(
EditorBrowsableState
.
Never
),
Obsolete
(
"Please use Score"
,
false
)]
...
...
@@ -43,7 +43,7 @@ public SortedSetEntry(RedisValue element, double score)
/// The unique element stored in the sorted set
/// </summary>
[
#if !
NETCORE
#if !
DNXCORE50
Browsable
(
false
),
#endif
EditorBrowsable
(
EditorBrowsableState
.
Never
),
Obsolete
(
"Please use Element"
,
false
)]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment