Skip to content

Commit

Permalink
Membase 1.6 compatibility.
Browse files Browse the repository at this point in the history
The hostname in the bucket list in 1.6 contains the management port too, not just the IP.
  • Loading branch information
enyim committed Jul 26, 2010
1 parent 9d2c29d commit 07218f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Northscale.Store/Deserialization.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Net;

namespace NorthScale.Store
{
Expand Down Expand Up @@ -31,6 +32,16 @@ public override int GetHashCode()

internal static readonly IEqualityComparer<BucketNode> ComparerInstance = new Comparer();

public IPAddress GetIP()
{
var tmp = this.hostname;
var index = tmp.IndexOf(':');
if (index > 0)
tmp = tmp.Substring(0, index);

return IPAddress.Parse(tmp);
}

#region [ Comparer ]
private class Comparer : IEqualityComparer<BucketNode>
{
Expand Down
2 changes: 1 addition & 1 deletion Northscale.Store/NorthScalePool.cs
Expand Up @@ -127,7 +127,7 @@ private void InitNodes(IEnumerable<BucketNode> nodes)
var mcNodes = nodes.Select(b => new MemcachedNode(
// create a memcached node for each bucket node
// TODO currently we expect that the API returns IP addresses, we should confirm this
new IPEndPoint(IPAddress.Parse(b.hostname),
new IPEndPoint(b.GetIP(),
portType == BucketPortType.Proxy ? b.ports.proxy : b.ports.direct),
this.configuration.SocketPool,
auth)).ToArray();
Expand Down

0 comments on commit 07218f2

Please sign in to comment.