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

Merge pull request #498 from jitsi/bugfix/4.4/bosh-connection

Fix BOSH connection establishment
This commit is contained in:
Florian Schmaus 2021-10-19 14:10:44 +02:00 committed by GitHub
commit 7199003f98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,6 +43,7 @@ import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.util.CloseableUtil; import org.jivesoftware.smack.util.CloseableUtil;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser; import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
import org.igniterealtime.jbosh.AbstractBody; import org.igniterealtime.jbosh.AbstractBody;
import org.igniterealtime.jbosh.BOSHClient; import org.igniterealtime.jbosh.BOSHClient;
@ -200,6 +201,13 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
+ getHost() + ":" + getPort() + "."; + getHost() + ":" + getPort() + ".";
throw new SmackException.SmackMessageException(errorMessage); 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 @Override
@ -511,7 +519,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
parseAndProcessStanza(parser); parseAndProcessStanza(parser);
break; break;
case "features": case "features":
parseFeatures(parser); parseFeaturesAndNotify(parser);
break; break;
case "error": case "error":
// Some BOSH error isn't stream error. // Some BOSH error isn't stream error.