aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-02-03 12:54:35 +0300
committerGravatar Vitaly Takmazov2017-02-03 12:54:35 +0300
commit463d66fce7ef0dfea2afd537e9ef51b5ddf322da (patch)
tree659106035a31a6338fd22cbab2f1cc9dbae6307d /juick-xmpp
parent836f39dc469d953d747fa38e21562441517db3ba (diff)
juick-xmpp: handle stream errors
Diffstat (limited to 'juick-xmpp')
-rw-r--r--juick-xmpp/build.gradle2
-rw-r--r--juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java6
2 files changed, 7 insertions, 1 deletions
diff --git a/juick-xmpp/build.gradle b/juick-xmpp/build.gradle
index 5bd71e64..1e078f44 100644
--- a/juick-xmpp/build.gradle
+++ b/juick-xmpp/build.gradle
@@ -5,7 +5,7 @@ apply plugin: 'com.github.ben-manes.versions'
dependencies {
compile project(':juick-server')
- compile 'com.github.juick:com.juick.xmpp:43212cf5ac'
+ compile 'com.github.juick:com.juick.xmpp:c77bca6a38'
compile "org.slf4j:slf4j-api:${rootProject.slf4jVersion}"
compile "org.springframework:spring-webmvc:${rootProject.springFrameworkVersion}"
compile "com.fasterxml.jackson.core:jackson-core:${rootProject.jacksonVersion}"
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 8713aa03..1cd914c9 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
@@ -4,6 +4,7 @@ import com.juick.components.XMPPServer;
import com.juick.xmpp.Iq;
import com.juick.xmpp.Message;
import com.juick.xmpp.Presence;
+import com.juick.xmpp.extensions.StreamError;
import com.juick.xmpp.utils.XmlUtils;
import org.xmlpull.v1.XmlPullParser;
import rocks.xmpp.addr.Jid;
@@ -139,6 +140,11 @@ public class ConnectionIn extends Connection implements Runnable {
}
} else if (isSecured() && tag.equals("stream") && parser.getNamespace().equals(NS_STREAM)) {
sendOpenStream(null, true);
+ } else if (tag.equals("error")) {
+ StreamError streamError = StreamError.parse(parser);
+ logger.warn("Stream error from {}: {}", streamID, streamError.getCondition());
+ xmpp.removeConnectionIn(this);
+ closeConnection();
} else {
String unhandledStanza = XmlUtils.parseToString(parser, true);
logger.warn("Unhandled stanza from {}: {}", streamID, unhandledStanza);