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
33072cb8
Commit
33072cb8
authored
Jan 18, 2016
by
Marc Gravell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #331 from antoinecellerier/cluster-fixes
Fix cluster configuration regressions from
6b317395
parents
c0d064f5
9019f58b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
1 deletion
+26
-1
ClusterConfiguration.cs
...xchange.Redis/StackExchange/Redis/ClusterConfiguration.cs
+26
-1
No files found.
StackExchange.Redis/StackExchange/Redis/ClusterConfiguration.cs
View file @
33072cb8
...
...
@@ -182,9 +182,17 @@ internal ClusterConfiguration(ServerSelectionStrategy serverSelectionStrategy, s
{
if
(
string
.
IsNullOrWhiteSpace
(
line
))
continue
;
var
node
=
new
ClusterNode
(
this
,
line
,
origin
);
// Be resilient to ":0 {master,slave},fail,noaddr" nodes
if
(
node
.
IsNoAddr
)
continue
;
// Override the origin value with the endpoint advertised with the target node to
// make sure that things like clusterConfiguration[clusterConfiguration.Origin]
// will work as expected.
if
(
node
.
IsMyself
)
this
.
origin
=
node
.
EndPoint
;
if
(
nodeLookup
.
ContainsKey
(
node
.
EndPoint
))
{
// Deal with conflicting node entries for the same endpoint
...
...
@@ -288,6 +296,8 @@ public sealed class ClusterNode : IEquatable<ClusterNode>, IComparable<ClusterN
private
readonly
EndPoint
endpoint
;
private
readonly
bool
isMyself
;
private
readonly
bool
isSlave
;
private
readonly
bool
isNoAddr
;
...
...
@@ -315,7 +325,17 @@ internal ClusterNode(ClusterConfiguration configuration, string raw, EndPoint or
var
flags
=
parts
[
2
].
Split
(
StringSplits
.
Comma
);
endpoint
=
Format
.
TryParseEndPoint
(
parts
[
1
]);
if
(
flags
.
Contains
(
"myself"
))
{
isMyself
=
true
;
if
(
endpoint
==
null
)
{
// Unconfigured cluster nodes might report themselves as endpoint ":{port}",
// hence the origin fallback value to make sure that we can address them
endpoint
=
origin
;
}
}
nodeId
=
parts
[
0
];
isSlave
=
flags
.
Contains
(
"slave"
);
isNoAddr
=
flags
.
Contains
(
"noaddr"
);
...
...
@@ -363,6 +383,11 @@ public IList<ClusterNode> Children
/// </summary>
public
EndPoint
EndPoint
{
get
{
return
endpoint
;
}
}
/// <summary>
/// Gets whether this is the node which responded to the CLUSTER NODES request
/// </summary>
public
bool
IsMyself
{
get
{
return
isMyself
;
}
}
/// <summary>
/// Gets whether this node is a slave
/// </summary>
...
...
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