diff options
author | Vitaly Takmazov | 2017-02-06 15:18:19 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-02-06 15:19:37 +0300 |
commit | 2fb5e8bd6e1af340fa9fa703906e95cd0e698db1 (patch) | |
tree | 607e0886160964fbd1c32fc73d0259c490629dc3 /juick-xmpp/src/main/java/com/juick/components/s2s | |
parent | 2be5fc6e0397b53173aa21298142d5fa66877fa5 (diff) |
juick-xmpp: handle stream errors in s2s out connection
Diffstat (limited to 'juick-xmpp/src/main/java/com/juick/components/s2s')
-rw-r--r-- | juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java | 6 |
1 files changed, 6 insertions, 0 deletions
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); |