From a655b877a25be63c4e368d08bcd6d5b96f96db60 Mon Sep 17 00:00:00 2001 From: Rob Austin Date: Mon, 6 Oct 2014 15:30:30 +0100 Subject: [PATCH] HCOLL-134 ( release draft cut of the code so that I can test it across my network ) --- .../openhft/chronicle/map/NodeDiscovery.java | 17 +++++++++++++++++ .../chronicle/map/NodeDiscoveryTest.java | 1 - 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/openhft/chronicle/map/NodeDiscovery.java b/src/main/java/net/openhft/chronicle/map/NodeDiscovery.java index b8e82e9aa..2eadbd970 100644 --- a/src/main/java/net/openhft/chronicle/map/NodeDiscovery.java +++ b/src/main/java/net/openhft/chronicle/map/NodeDiscovery.java @@ -594,10 +594,27 @@ class AddressAndPort implements Comparable, BytesMarshallable { '}'; } + final static int INADDRSZ = 16; + final static int INT16SZ = 2; + static String numericToTextFormat(byte[] src) { if (src.length == 4) { return (src[0] & 0xff) + "." + (src[1] & 0xff) + "." + (src[2] & 0xff) + "." + (src[3] & 0xff); } + + if (src.length == 6) { + + StringBuffer sb = new StringBuffer(39); + for (int i = 0; i < (INADDRSZ / INT16SZ); i++) { + sb.append(Integer.toHexString(((src[i << 1] << 8) & 0xff00) + | (src[(i << 1) + 1] & 0xff))); + if (i < (INADDRSZ / INT16SZ) - 1) { + sb.append(":"); + } + } + return sb.toString(); + + } throw new UnsupportedOperationException(); } diff --git a/src/test/java/net/openhft/chronicle/map/NodeDiscoveryTest.java b/src/test/java/net/openhft/chronicle/map/NodeDiscoveryTest.java index c590203e2..822f04bf6 100644 --- a/src/test/java/net/openhft/chronicle/map/NodeDiscoveryTest.java +++ b/src/test/java/net/openhft/chronicle/map/NodeDiscoveryTest.java @@ -22,7 +22,6 @@ public class NodeDiscoveryTest { (short) 1237); final ChronicleMap map = nodeDiscovery.discoverMap(8123, ourAddressAndPort1); - Thread.sleep(1000000); }