mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-24 11:38:00 +01:00
[bosh] Fix BOSH debug send message not shown
Following logcat are captured with various PR fixes implemented: // ===== Without any of the PR fixes ===== // All the sent stanza are missing; fixed by ``` // Fix all BOSH sent debug messages not shown writer.flush(); ``` ``` 2023-12-11 12:25:33.548 5470-5636/org.atalk.android D/SMACK: RECV (0): <body xmpp:version='1.0' authid='4867162268865181478' xmlns='http://jabber.org/protocol/httpbind' sid='53e66759d21e128cc1cba8d00aacb7421f1ea960' wait='60' ver='1.11' polling='2' inactivity='30' hold='1' xmpp:restartlogic='true' requests='2' secure='true' maxpause='120' xmlns:xmpp='urn:xmpp:xbosh' xmlns:stream='http://etherx.jabber.org/streams' from='atalk.sytes.net'> <stream:features> <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'> <mechanism> PLAIN </mechanism> <mechanism> SCRAM-SHA-1 </mechanism> <mechanism> X-OAUTH2 </mechanism> </mechanisms> <register xmlns='http://jabber.org/features/iq-register'/> </stream:features> </body> 2023-12-11 12:25:33.748 5470-5636/org.atalk.android D/SMACK: RECV (0): <body xmlns='http://jabber.org/protocol/httpbind'/> 2023-12-11 12:25:33.925 5470-5636/org.atalk.android D/SMACK: RECV (0): <body xmlns='http://jabber.org/protocol/httpbind'> <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'> cj1DI2QjJHE7JVs6LzElInQnPDhaK3JLMTUzPCtPVicvXmNuV204ei9kV1UzT1lsdCtzRW1ZTkE9PSxzPTdjNktCSnNaTHdTYjNZSytqdVRXb2c9PSxpPTQwOTY= </challenge> </body> 2023-12-11 12:25:33.939 5470-5636/org.atalk.android D/SMACK: RECV (0): <body xmlns='http://jabber.org/protocol/httpbind'> <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'> dj1saEFrUzVKMFRBMEJVbTg1djd5dE4xTUpZaE09 </success> </body> ``` // ===== With only PR fixes: writer.flush(); readerConsumer = null; but withoug the following fixes ===== // // Initialize the debugger before addBOSHClientResponseListener(new BOSHPacketReader()); // BOSHPacketReader may hold and send response prior to display of the request i.e. \<response/> before \<challenge/> ``` 2023-12-11 12:33:54.915 6162-6310/org.atalk.android D/SMACK: SENT (0): <body ver='1.8' wait='60' xmpp:version='1.0' rid='6195788493952909' xmlns:xmpp='urn:xmpp:xbosh' hold='1' xml:lang='en' ack='1' to='atalk.sytes.net' xmlns='http://jabber.org/protocol/httpbind'> </body> 2023-12-11 12:33:55.198 6162-6314/org.atalk.android D/SMACK: RECV (0): <body xmpp:version='1.0' authid='1477509259581416251' xmlns='http://jabber.org/protocol/httpbind' sid='796ae552c9fea53ff10a1979429396d19745d430' wait='60' ver='1.11' polling='2' inactivity='30' hold='1' xmpp:restartlogic='true' requests='2' secure='true' maxpause='120' xmlns:xmpp='urn:xmpp:xbosh' xmlns:stream='http://etherx.jabber.org/streams' from='atalk.sytes.net'> <stream:features> <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'> <mechanism> PLAIN </mechanism> <mechanism> SCRAM-SHA-1 </mechanism> <mechanism> X-OAUTH2 </mechanism> </mechanisms> <register xmlns='http://jabber.org/features/iq-register'/> </stream:features> </body> 2023-12-11 12:33:55.301 6162-6310/org.atalk.android D/SMACK: SENT (0): <body rid='6195788493952910' sid='796ae552c9fea53ff10a1979429396d19745d430' xmlns='http://jabber.org/protocol/httpbind'> <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='SCRAM-SHA-1'> bixhPXN3YW5AYXRhbGsuc3l0ZXMubmV0LG49c3dhbixyPUJwMTZzKG9dd0xmb1lnN0haRkAjKko7PiReIXhbKiou </auth> </body> 2023-12-11 12:33:55.534 6162-6313/org.atalk.android D/SMACK: SENT (0): <body rid='6195788493952911' ack='6195788493952909' sid='796ae552c9fea53ff10a1979429396d19745d430' xmlns='http://jabber.org/protocol/httpbind'> <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'> Yz1iaXhoUFhOM1lXNUFZWFJoYkdzdWMzbDBaWE11Ym1WMExBPT0scj1CcDE2cyhvXXdMZm9ZZzdIWkZAIypKOz4kXiF4WyoqLlV4eTcvUVBCQUNKbjg1TWdRZHhjQnc9PSxwPVZlT3pkVzExN0tMc3k4THZpQWJZWDlpcW84az0= </response> </body> 2023-12-11 12:33:55.538 6162-6314/org.atalk.android D/SMACK: RECV (0): <body xmlns='http://jabber.org/protocol/httpbind'> <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'> cj1CcDE2cyhvXXdMZm9ZZzdIWkZAIypKOz4kXiF4WyoqLlV4eTcvUVBCQUNKbjg1TWdRZHhjQnc9PSxzPTdjNktCSnNaTHdTYjNZSytqdVRXb2c9PSxpPTQwOTY= </challenge> </body> 2023-12-11 12:33:55.558 6162-6310/org.atalk.android D/SMACK: SENT (0): <body xmpp:restart='true' rid='6195788493952912' xmlns:xmpp='urn:xmpp:xbosh' sid='796ae552c9fea53ff10a1979429396d19745d430' to='atalk.sytes.net' xmlns='http://jabber.org/protocol/httpbind'> </body> 2023-12-11 12:33:55.560 6162-6314/org.atalk.android D/SMACK: RECV (0): <body xmlns='http://jabber.org/protocol/httpbind'> <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'> dj1mcFdSekE1SXltdTBrNys4K1hML3JncTVEd2s9 </success> </body> ``` // ===== With the full PR fixes ===== // ``` 2023-12-11 12:21:16.435 4703-5344/org.atalk.android D/SMACK: SENT (4): <body ver='1.8' wait='60' xmpp:version='1.0' rid='949729322134413' xmlns:xmpp='urn:xmpp:xbosh' hold='1' xml:lang='en' ack='1' to='atalk.sytes.net' xmlns='http://jabber.org/protocol/httpbind'> </body> 2023-12-11 12:21:16.637 4703-5348/org.atalk.android D/SMACK: RECV (4): <body xmpp:version='1.0' authid='1761920914298566866' xmlns='http://jabber.org/protocol/httpbind' sid='25ba67c4b943796418a2b7c064085327ab9c35ac' wait='60' ver='1.11' polling='2' inactivity='30' hold='1' xmpp:restartlogic='true' requests='2' secure='true' maxpause='120' xmlns:xmpp='urn:xmpp:xbosh' xmlns:stream='http://etherx.jabber.org/streams' from='atalk.sytes.net'> <stream:features> <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'> <mechanism> PLAIN </mechanism> <mechanism> SCRAM-SHA-1 </mechanism> <mechanism> X-OAUTH2 </mechanism> </mechanisms> <register xmlns='http://jabber.org/features/iq-register'/> </stream:features> </body> 2023-12-11 12:21:16.667 4703-5344/org.atalk.android D/SMACK: SENT (4): <body rid='949729322134414' sid='25ba67c4b943796418a2b7c064085327ab9c35ac' xmlns='http://jabber.org/protocol/httpbind'> <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='SCRAM-SHA-1'> bixhPXN3YW5AYXRhbGsuc3l0ZXMubmV0LG49c3dhbixyPTdiSVxeVnVMU0ZoWT8zVVlSa2psdkVMeks/e3BaQUwp </auth> </body> 2023-12-11 12:21:16.683 4703-5348/org.atalk.android D/SMACK: RECV (4): <body xmlns='http://jabber.org/protocol/httpbind'> <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'> cj03YklcXlZ1TFNGaFk/M1VZUmtqbHZFTHpLP3twWkFMKUhqVjVlVFUvdzJFaW9yQjlGdHh3T3c9PSxzPTdjNktCSnNaTHdTYjNZSytqdVRXb2c9PSxpPTQwOTY= </challenge> </body> 2023-12-11 12:21:16.689 4703-5347/org.atalk.android D/SMACK: SENT (4): <body rid='949729322134415' ack='949729322134413' sid='25ba67c4b943796418a2b7c064085327ab9c35ac' xmlns='http://jabber.org/protocol/httpbind'> <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'> Yz1iaXhoUFhOM1lXNUFZWFJoYkdzdWMzbDBaWE11Ym1WMExBPT0scj03YklcXlZ1TFNGaFk/M1VZUmtqbHZFTHpLP3twWkFMKUhqVjVlVFUvdzJFaW9yQjlGdHh3T3c9PSxwPXdNb2c5N3UzQktON1FHaFVQRzQ3MHVjZXdldz0= </response> </body> 2023-12-11 12:21:16.702 4703-5348/org.atalk.android D/SMACK: RECV (4): <body xmlns='http://jabber.org/protocol/httpbind'> <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'> dj0yTzRqVzJXWHdEUDdvNjdJSkdNU3Rmc0NMTkk9 </success> </body> 2023-12-11 12:21:16.704 4703-5344/org.atalk.android D/SMACK: SENT (4): <body xmpp:restart='true' rid='949729322134416' xmlns:xmpp='urn:xmpp:xbosh' sid='25ba67c4b943796418a2b7c064085327ab9c35ac' to='atalk.sytes.net' xmlns='http://jabber.org/protocol/httpbind'> </body> ``` Link: https://github.com/igniterealtime/Smack/pull/554
This commit is contained in:
parent
390f6f0fa7
commit
bd70d6abc5
1 changed files with 9 additions and 5 deletions
|
@ -165,14 +165,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)
|
||||
|
@ -295,10 +296,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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -376,6 +378,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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue