Skip to content

Commit

Permalink
Merge branch '4.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
Flowdalic committed Dec 11, 2023
2 parents 90b8eee + bd70d6a commit f6de30c
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,15 @@ protected void connectInternal() throws SmackException, InterruptedException {

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)
Expand Down Expand Up @@ -359,10 +360,11 @@ public void instantShutdown() {
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;
}

/**
Expand Down Expand Up @@ -440,6 +442,8 @@ public void requestSent(BOSHMessageEvent event) {
if (event.getBody() != null) {
try {
writer.write(event.getBody().toXML());
// Fix all BOSH sent debug messages not shown
writer.flush();
} catch (Exception e) {
// Ignore
}
Expand Down

0 comments on commit f6de30c

Please sign in to comment.