1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 03:52:06 +01:00

Merge branch '4.4'

This commit is contained in:
Florian Schmaus 2023-12-11 11:18:03 +01:00
commit f6de30c218

View file

@ -172,14 +172,15 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
client = BOSHClient.create(cfgBuilder.build()); client = BOSHClient.create(cfgBuilder.build());
client.addBOSHClientConnListener(new BOSHConnectionListener()); // Initialize the debugger before addBOSHClientResponseListener(new BOSHPacketReader());
client.addBOSHClientResponseListener(new BOSHPacketReader()); // BOSHPacketReader may hold and send response prior to display of the request i.e. <response/> before <challenge/>
// Initialize the debugger
if (debugger != null) { if (debugger != null) {
initDebugger(); initDebugger();
} }
client.addBOSHClientConnListener(new BOSHConnectionListener());
client.addBOSHClientResponseListener(new BOSHPacketReader());
// Send the session creation request // Send the session creation request
client.send(ComposableBody.builder() client.send(ComposableBody.builder()
.setNamespaceDefinition("xmpp", XMPP_BOSH_NS) .setNamespaceDefinition("xmpp", XMPP_BOSH_NS)
@ -359,10 +360,11 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
CloseableUtil.maybeClose(reader, LOGGER); CloseableUtil.maybeClose(reader, LOGGER);
CloseableUtil.maybeClose(writer, LOGGER); CloseableUtil.maybeClose(writer, LOGGER);
// set readerConsumer = null before reader to avoid NPE reference
readerConsumer = null;
readerPipe = null; readerPipe = null;
reader = null; reader = null;
writer = null; writer = null;
readerConsumer = null;
} }
/** /**
@ -440,6 +442,8 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
if (event.getBody() != null) { if (event.getBody() != null) {
try { try {
writer.write(event.getBody().toXML()); writer.write(event.getBody().toXML());
// Fix all BOSH sent debug messages not shown
writer.flush();
} catch (Exception e) { } catch (Exception e) {
// Ignore // Ignore
} }