From 2fb5e8bd6e1af340fa9fa703906e95cd0e698db1 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 6 Feb 2017 15:18:19 +0300 Subject: juick-xmpp: handle stream errors in s2s out connection --- .../src/main/java/com/juick/components/s2s/ConnectionOut.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'juick-xmpp/src') 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 5f990ccd..99df858e 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 @@ -2,6 +2,7 @@ package com.juick.components.s2s; import com.juick.components.XMPPServer; import com.juick.components.s2s.util.DialbackUtils; +import com.juick.xmpp.extensions.StreamError; import com.juick.xmpp.extensions.StreamFeatures; import com.juick.xmpp.utils.XmlUtils; import org.apache.commons.lang3.RandomStringUtils; @@ -143,6 +144,11 @@ public class ConnectionOut extends Connection implements Runnable { } } else if (isSecured() && tag.equals("stream") && parser.getNamespace().equals(NS_STREAM)) { streamID = parser.getAttributeValue(null, "id"); + } else if (tag.equals("error")) { + StreamError streamError = StreamError.parse(parser); + logger.warn("Stream error from {}: {}", streamID, streamError.getCondition()); + xmpp.removeConnectionOut(this); + closeConnection(); } else { String unhandledStanza = XmlUtils.parseToString(parser, true); logger.warn("Unhandled stanza from {} {} : {}", to, streamID, unhandledStanza); -- cgit v1.2.3