From 09ebad6b9dcb02fd35f15b02c4aa7da279d8f454 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 24 Jan 2017 12:37:43 +0300 Subject: juick-xmpp: refactoring --- .../src/main/java/com/juick/components/s2s/ConnectionIn.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'juick-xmpp/src/main/java/com/juick/components') diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java b/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java index ec996071..882cc2f7 100644 --- a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java +++ b/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java @@ -72,6 +72,7 @@ public class ConnectionIn extends Connection implements Runnable { String to = parser.getAttributeValue(null, "to"); logger.info("stream from {} to {} {} asking for dialback", dfrom, to, streamID); if (dfrom.endsWith(xmpp.HOSTNAME) && (dfrom.equals(xmpp.HOSTNAME) || dfrom.endsWith("." + xmpp.HOSTNAME))) { + logger.warn("stream from {} is invalid", dfrom); break; } if (to != null && to.equals(xmpp.HOSTNAME)) { @@ -79,7 +80,8 @@ public class ConnectionIn extends Connection implements Runnable { updateTsRemoteData(); xmpp.startDialback(dfrom, streamID, dbKey); } else { - throw new HostUnknownException("stream from " + dfrom + " " + streamID + " invalid to " + to); + logger.warn("stream from " + dfrom + " " + streamID + " invalid to " + to); + break; } } else if (tag.equals("verify") && parser.getNamespace().equals(NS_DB)) { String vfrom = parser.getAttributeValue(null, "from"); @@ -149,8 +151,6 @@ public class ConnectionIn extends Connection implements Runnable { logger.info("stream {} closed (dirty)", streamID); xmpp.removeConnectionIn(this); closeConnection(); - } catch (HostUnknownException e) { - logger.warn(e.getMessage()); } catch (Exception e) { logger.warn("stream {} error {}", streamID, e); xmpp.removeConnectionIn(this); @@ -201,10 +201,4 @@ public class ConnectionIn extends Connection implements Runnable { } return false; } - - class HostUnknownException extends Exception { - public HostUnknownException(String message) { - super(message); - } - } } -- cgit v1.2.3