From 51bfc341be1975b7a11e0b3a59cfbb4710e78446 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 4 Oct 2017 15:31:44 +0300 Subject: juick-xmpp-wip: router component --- .../main/java/com/juick/components/s2s/ConnectionOut.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java') diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java b/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java index 903eec0c..589ed18a 100644 --- a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java +++ b/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java @@ -38,6 +38,7 @@ import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; +import java.util.Arrays; import java.util.UUID; /** @@ -97,7 +98,6 @@ public class ConnectionOut extends Connection implements Runnable { } logger.info("stream to {} {} open", to, streamID); - xmpp.addConnectionOut(ConnectionOut.this); boolean xmppversionnew = parser.getAttributeValue(null, "version") != null; if (!xmppversionnew) { processDialback(); @@ -131,15 +131,12 @@ public class ConnectionOut extends Connection implements Runnable { String type = parser.getAttributeValue(null, "type"); String sid = parser.getAttributeValue(null, "id"); if (from != null && from.equals(to) && sid != null && !sid.isEmpty() && type != null) { - ConnectionIn c = xmpp.getConnectionIn(sid); - if (c != null) { - c.sendDialbackResult(from, type); - } + xmpp.getConnectionIn(sid).ifPresent(c -> c.sendDialbackResult(from, type)); } XmlUtils.skip(parser); } else if (tag.equals("features") && parser.getNamespace().equals(NS_STREAM)) { StreamFeatures features = StreamFeatures.parse(parser); - if (sc != null && !isSecured() && features.STARTTLS >= 0 && !xmpp.brokenSSLhosts.contains(to)) { + if (sc != null && !isSecured() && features.STARTTLS >= 0 && !Arrays.asList(xmpp.brokenSSLhosts).contains(to)) { logger.info("stream to {} {} securing", to, streamID); sendStanza(""); } else { @@ -191,10 +188,4 @@ public class ConnectionOut extends Connection implements Runnable { sendStanza("" + key + ""); } - - @Override - public void restartParser() throws XmlPullParserException, IOException { - super.restartParser(); - streamID = UUID.randomUUID().toString(); - } } -- cgit v1.2.3