Commit 49032af6 authored by Antoine Cellerier's avatar Antoine Cellerier

Add resilience to known nodes with the noaddr flag.

parent 9a4e4087
......@@ -182,6 +182,9 @@ 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;
nodeLookup.Add(node.EndPoint, node);
}
}
......@@ -262,6 +265,8 @@ public sealed class ClusterNode : IEquatable<ClusterNode>, IComparable<ClusterN
private readonly bool isSlave;
private readonly bool isNoAddr;
private readonly string nodeId, parentNodeId, raw;
private readonly IList<SlotRange> slots;
......@@ -291,6 +296,7 @@ internal ClusterNode(ClusterConfiguration configuration, string raw, EndPoint or
}
nodeId = parts[0];
isSlave = flags.Contains("slave");
isNoAddr = flags.Contains("noaddr");
parentNodeId = string.IsNullOrWhiteSpace(parts[3]) ? null : parts[3];
List<SlotRange> slots = null;
......@@ -339,6 +345,11 @@ public IList<ClusterNode> Children
/// </summary>
public bool IsSlave { get { return isSlave; } }
/// <summary>
/// Gets whether this node is flagged as noaddr
/// </summary>
public bool IsNoAddr { get { return isNoAddr; } }
/// <summary>
/// Gets the unique node-id of the current node
/// </summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment