Merge branch '4.4'

This commit is contained in:
Florian Schmaus 2023-12-11 11:18:03 +01:00
commit f6de30c218
1 changed files with 9 additions and 5 deletions

View File

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