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
4212ddeb
Commit
4212ddeb
authored
May 29, 2018
by
Nick Craver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mono support...trying to...
parent
a56779c1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
12 deletions
+41
-12
ConnectionMultiplexer.cs
...change.Redis/StackExchange/Redis/ConnectionMultiplexer.cs
+1
-7
PhysicalConnection.cs
...kExchange.Redis/StackExchange/Redis/PhysicalConnection.cs
+0
-3
PlatformHelper.cs
StackExchange.Redis/StackExchange/Redis/PlatformHelper.cs
+38
-0
SocketManager.Poll.cs
...kExchange.Redis/StackExchange/Redis/SocketManager.Poll.cs
+2
-2
No files found.
StackExchange.Redis/StackExchange/Redis/ConnectionMultiplexer.cs
View file @
4212ddeb
...
@@ -194,13 +194,7 @@ internal void OnErrorMessage(EndPoint endpoint, string message)
...
@@ -194,13 +194,7 @@ internal void OnErrorMessage(EndPoint endpoint, string message)
[
System
.
Diagnostics
.
CodeAnalysis
.
SuppressMessage
(
"Microsoft.Usage"
,
"CA2202:Do not dispose objects multiple times"
)]
[
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
)
private
static
void
Write
<
T
>(
ZipArchive
zip
,
string
name
,
Task
task
,
Action
<
T
,
StreamWriter
>
callback
)
{
{
var
entry
=
zip
.
CreateEntry
(
name
,
var
entry
=
zip
.
CreateEntry
(
name
,
PlatformHelper
.
GetCompressionLevel
(
nameof
(
CompressionLevel
.
Optimal
)));
#if __MonoCS__
CompressionLevel
.
Fastest
#else
CompressionLevel
.
Optimal
#endif
);
using
(
var
stream
=
entry
.
Open
())
using
(
var
stream
=
entry
.
Open
())
using
(
var
writer
=
new
StreamWriter
(
stream
))
using
(
var
writer
=
new
StreamWriter
(
stream
))
{
{
...
...
StackExchange.Redis/StackExchange/Redis/PhysicalConnection.cs
View file @
4212ddeb
...
@@ -741,9 +741,6 @@ SocketMode ISocketCallback.Connected(Stream stream, TextWriter log)
...
@@ -741,9 +741,6 @@ SocketMode ISocketCallback.Connected(Stream stream, TextWriter log)
var
ssl
=
new
SslStream
(
stream
,
false
,
config
.
CertificateValidationCallback
,
var
ssl
=
new
SslStream
(
stream
,
false
,
config
.
CertificateValidationCallback
,
config
.
CertificateSelectionCallback
??
GetAmbientCertificateCallback
()
config
.
CertificateSelectionCallback
??
GetAmbientCertificateCallback
()
#if !__MonoCS__
,
EncryptionPolicy
.
RequireEncryption
#endif
);
);
try
try
{
{
...
...
StackExchange.Redis/StackExchange/Redis/PlatformHelper.cs
0 → 100644
View file @
4212ddeb
using
System
;
using
System.IO
;
using
System.IO.Compression
;
using
System.Net.Security
;
namespace
StackExchange.Redis
{
internal
class
PlatformHelper
{
public
static
SocketMode
DefaultSocketMode
=
IsMono
&&
IsUnix
?
SocketMode
.
Async
:
SocketMode
.
Poll
;
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
;
/// <summary>
/// Gets the compression level from a string, avoiding a naming bug inside ancient mono versions.
/// </summary>
/// <remarks>
/// See: https://github.com/mono/mono/commit/714efcf7d1f9c9017b370af16bb3117179dd60e5
/// </remarks>
/// <param name="level">The level.</param>
/// <returns></returns>
public
static
CompressionLevel
GetCompressionLevel
(
string
level
)
{
try
{
return
(
CompressionLevel
)
Enum
.
Parse
(
typeof
(
CompressionLevel
),
level
);
}
catch
(
ArgumentException
)
{
// Oops, ancient mono here.. let's tray again.
return
(
CompressionLevel
)
Enum
.
Parse
(
typeof
(
CompressionLevel
),
level
.
Replace
(
nameof
(
CompressionLevel
.
Optimal
),
"Optional"
));
}
}
}
}
StackExchange.Redis/StackExchange/Redis/SocketManager.Poll.cs
View file @
4212ddeb
...
@@ -10,7 +10,7 @@ namespace StackExchange.Redis
...
@@ -10,7 +10,7 @@ namespace StackExchange.Redis
{
{
public
partial
class
SocketManager
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
IntPtr
[]
EmptyPointers
=
new
IntPtr
[
0
];
private
static
readonly
WaitCallback
HelpProcessItems
=
state
=>
private
static
readonly
WaitCallback
HelpProcessItems
=
state
=>
{
{
...
@@ -429,4 +429,4 @@ internal void Pulse()
...
@@ -429,4 +429,4 @@ internal void Pulse()
}
}
}
}
}
}
#
endif
#endif
\ No newline at end of file
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