From 956b646e2a02130d45d59efa8dbac5c1daabb255 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 25 Mar 2014 18:12:27 +0100 Subject: more srv lookup fixes --- src/eu/siacs/conversations/utils/DNSHelper.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/eu/siacs/conversations/utils/DNSHelper.java') diff --git a/src/eu/siacs/conversations/utils/DNSHelper.java b/src/eu/siacs/conversations/utils/DNSHelper.java index c20b45ec..d28a727c 100644 --- a/src/eu/siacs/conversations/utils/DNSHelper.java +++ b/src/eu/siacs/conversations/utils/DNSHelper.java @@ -96,12 +96,23 @@ public class DNSHelper { ++i; } builder.replace(0, 1, ""); + + //TODO: workaround. speak proper dns later + if (!builder.toString().contains(".")) { + namePort.putString("error", "nosrv"); + return namePort; + } namePort.putString("name",builder.toString()); return namePort; } static int calcPort(byte hb, byte lb) { - return ((int) hb << 8) | ((int) lb & 0xFF); + int port = ((int) hb << 8) | ((int) lb & 0xFF); + if (port>=0) { + return port; + } else { + return 65536 + port; + } } final protected static char[] hexArray = "0123456789ABCDEF".toCharArray(); -- cgit v1.2.3