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
d6653d3b
Commit
d6653d3b
authored
Sep 03, 2018
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
another attempt to invesstigate #883
parent
3d057200
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
3 deletions
+49
-3
ConnectionMultiplexer.cs
src/StackExchange.Redis/ConnectionMultiplexer.cs
+6
-2
Config.cs
tests/StackExchange.Redis.Tests/Config.cs
+1
-1
SSL.cs
tests/StackExchange.Redis.Tests/SSL.cs
+42
-0
No files found.
src/StackExchange.Redis/ConnectionMultiplexer.cs
View file @
d6653d3b
...
@@ -817,7 +817,7 @@ private static async Task<ConnectionMultiplexer> ConnectImplAsync(object configu
...
@@ -817,7 +817,7 @@ private static async Task<ConnectionMultiplexer> ConnectImplAsync(object configu
public
static
Task
<
ConnectionMultiplexer
>
ConnectAsync
(
ConfigurationOptions
configuration
,
TextWriter
log
=
null
)
public
static
Task
<
ConnectionMultiplexer
>
ConnectAsync
(
ConfigurationOptions
configuration
,
TextWriter
log
=
null
)
=>
ConnectImplAsync
(
configuration
,
log
);
=>
ConnectImplAsync
(
configuration
,
log
);
private
static
ConnectionMultiplexer
CreateMultiplexer
(
object
configuration
,
TextWriter
log
,
out
EventHandler
<
ConnectionFailedEventArgs
>
connectHandler
)
internal
static
ConfigurationOptions
PrepareConfig
(
object
configuration
)
{
{
if
(
configuration
==
null
)
throw
new
ArgumentNullException
(
nameof
(
configuration
));
if
(
configuration
==
null
)
throw
new
ArgumentNullException
(
nameof
(
configuration
));
ConfigurationOptions
config
;
ConfigurationOptions
config
;
...
@@ -835,7 +835,11 @@ private static ConnectionMultiplexer CreateMultiplexer(object configuration, Tex
...
@@ -835,7 +835,11 @@ private static ConnectionMultiplexer CreateMultiplexer(object configuration, Tex
}
}
if
(
config
.
EndPoints
.
Count
==
0
)
throw
new
ArgumentException
(
"No endpoints specified"
,
nameof
(
configuration
));
if
(
config
.
EndPoints
.
Count
==
0
)
throw
new
ArgumentException
(
"No endpoints specified"
,
nameof
(
configuration
));
config
.
SetDefaultPorts
();
config
.
SetDefaultPorts
();
var
muxer
=
new
ConnectionMultiplexer
(
config
);
return
config
;
}
private
static
ConnectionMultiplexer
CreateMultiplexer
(
object
configuration
,
TextWriter
log
,
out
EventHandler
<
ConnectionFailedEventArgs
>
connectHandler
)
{
var
muxer
=
new
ConnectionMultiplexer
(
PrepareConfig
(
configuration
));
connectHandler
=
null
;
connectHandler
=
null
;
if
(
log
!=
null
)
if
(
log
!=
null
)
{
{
...
...
tests/StackExchange.Redis.Tests/Config.cs
View file @
d6653d3b
...
@@ -10,7 +10,7 @@ namespace StackExchange.Redis.Tests
...
@@ -10,7 +10,7 @@ namespace StackExchange.Redis.Tests
{
{
public
class
Config
:
TestBase
public
class
Config
:
TestBase
{
{
public
Config
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
Config
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
[
Fact
]
[
Fact
]
public
void
SslProtocols_SingleValue
()
public
void
SslProtocols_SingleValue
()
...
...
tests/StackExchange.Redis.Tests/SSL.cs
View file @
d6653d3b
...
@@ -2,7 +2,10 @@
...
@@ -2,7 +2,10 @@
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Diagnostics
;
using
System.IO
;
using
System.IO
;
using
System.Linq
;
using
System.Net
;
using
System.Net.Security
;
using
System.Net.Security
;
using
System.Reflection
;
using
System.Security.Cryptography.X509Certificates
;
using
System.Security.Cryptography.X509Certificates
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
StackExchange.Redis.Tests.Helpers
;
using
StackExchange.Redis.Tests.Helpers
;
...
@@ -319,6 +322,45 @@ public void SSLHostInferredFromEndpoints()
...
@@ -319,6 +322,45 @@ public void SSLHostInferredFromEndpoints()
Assert
.
True
(
options
.
SslHost
==
null
);
Assert
.
True
(
options
.
SslHost
==
null
);
}
}
private
void
Check
(
string
name
,
object
x
,
object
y
)
{
Writer
.
WriteLine
(
$"
{
name
}
:
{(
x
==
null
?
"(null)"
:
x
.
ToString
())}
vs
{(
y
==
null
?
"(null)"
:
y
.
ToString
())}
"
);
Assert
.
Equal
(
x
,
y
);
}
[
Fact
]
public
void
Issue883_Exhaustive
()
{
var
a
=
ConnectionMultiplexer
.
PrepareConfig
(
"myDNS:883,password=mypassword,connectRetry=3,connectTimeout=5000,syncTimeout=5000,defaultDatabase=0,ssl=true,abortConnect=false"
);
var
b
=
ConnectionMultiplexer
.
PrepareConfig
(
new
ConfigurationOptions
{
EndPoints
=
{
{
"myDNS"
,
883
}
},
Password
=
"mypassword"
,
ConnectRetry
=
3
,
ConnectTimeout
=
5000
,
SyncTimeout
=
5000
,
DefaultDatabase
=
0
,
Ssl
=
true
,
AbortOnConnectFail
=
false
,
});
Writer
.
WriteLine
(
$"computed:
{
b
.
ToString
(
true
)}
"
);
Writer
.
WriteLine
(
"Checking endpoints..."
);
var
c
=
a
.
EndPoints
.
Cast
<
DnsEndPoint
>().
Single
();
var
d
=
b
.
EndPoints
.
Cast
<
DnsEndPoint
>().
Single
();
Check
(
nameof
(
c
.
Host
),
c
.
Host
,
d
.
Host
);
Check
(
nameof
(
c
.
Port
),
c
.
Port
,
d
.
Port
);
Check
(
nameof
(
c
.
AddressFamily
),
c
.
AddressFamily
,
d
.
AddressFamily
);
var
fields
=
typeof
(
ConfigurationOptions
).
GetFields
(
BindingFlags
.
Instance
|
BindingFlags
.
Public
|
BindingFlags
.
NonPublic
);
Writer
.
WriteLine
(
$"Comparing
{
fields
.
Length
}
fields..."
);
Array
.
Sort
(
fields
,
(
x
,
y
)
=>
string
.
Compare
(
x
.
Name
,
y
.
Name
));
foreach
(
var
field
in
fields
)
{
Check
(
field
.
Name
,
field
.
GetValue
(
a
),
field
.
GetValue
(
b
));
}
}
[
Fact
]
[
Fact
]
public
void
SSLParseViaConfig_Issue883_ConfigObject
()
public
void
SSLParseViaConfig_Issue883_ConfigObject
()
{
{
...
...
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