1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-24 21:12:05 +01:00

Fix BOSH connection establishment

AbstractXMPPConnection waits for the flag lastFeaturesReceived since
57961a8cc1, but it is never set from
BOSH connections. Use parseFeaturesAndNotify instead of
parseFeatures to set the signal.

Similarly the XmlEnvironment is not set from bosh, but required in
ParserUtils.getXmlLang.
This commit is contained in:
Ingo Bauersachs 2021-10-16 21:22:42 +02:00
parent ec456399b5
commit 8074ddd60a

View file

@ -43,6 +43,7 @@ import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.util.CloseableUtil;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
import org.igniterealtime.jbosh.AbstractBody;
import org.igniterealtime.jbosh.BOSHClient;
@ -200,6 +201,13 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
+ getHost() + ":" + getPort() + ".";
throw new SmackException.SmackMessageException(errorMessage);
}
try {
XmlPullParser parser = PacketParserUtils.getParserFor("<stream:stream xmlns='jabber:client'/>");
onStreamOpen(parser);
} catch (XmlPullParserException | IOException e) {
throw new AssertionError("Failed to setup stream environment", e);
}
}
@Override
@ -511,7 +519,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
parseAndProcessStanza(parser);
break;
case "features":
parseFeatures(parser);
parseFeaturesAndNotify(parser);
break;
case "error":
// Some BOSH error isn't stream error.