AnsweredAssumed Answered

Received IQ dropping elements between RCV and processPacket

Question asked by Dan Devine on Aug 29, 2014
Latest reply on Aug 31, 2014 by Dan Devine

I'm attempting to receive a custom IQ result packet on Smack 4.1.0-alpha1-SNAPSHOT, and some of the XML elements are being dropped between the reception of the packet and the delivery to my listener.

 

I've set SmackConfiguration.DEBUG_ENABLED = true, and I receive the following stanza: (Cleaned up a little to make readable)

 

11:11:59 PM RCV  (1631684231): 
<iq type="result" id="j6p8N-33" from="lighthouse.seattle1.adspore.com"
          to="bot_ijyffc@seattle1.adspore.com/Smack">
     <account xmlns="http://adspore.com/v1/lighthouse">
          <username>bot_ijyffc@seattle1.adspore.com</username>
          <email>foo@foo.bar</email>
          <objectid>2002126324076833545</objectid>
          <visibility>true</visibility>
     </account>
</iq>

 

However, by the time it reaches my PacketFilter/PacketListener, it looks like this...


<iq id='j6p8N-33' to='bot_ijyffc@seattle1.adspore.com/Smack' 
          from='lighthouse.seattle1.adspore.com' type='result'>
          .... missing bits....
          true</visibility>
</iq>

 

I've configured a PacketFilter to accept everything, and add the listener for it just before sending the outgoing IQ like this:

 

    public void sendAccount() {
        AccountIQ accountIQ = new AccountIQ(getUsername(), "foo@foo.bar", true, 0L);
        accountIQ.setTo(Main.SERVICE);
        accountIQ.setFrom(mConnection.getUser());
        accountIQ.setType(IQ.Type.set);
        LOG.info("Sending AccountInfo:" + accountIQ.toString());
        try {
            mConnection.addPacketListener(this, new AcceptEverythingPacketFilter());
            mConnection.sendPacket(accountIQ);
        } catch (SmackException.NotConnectedException e) {
            LOG.error("Caught exception", e);
        }
    }

 

 

Here is the PacketFilter and handler:

 

    @Override
    public void processPacket(Packet packet) throws SmackException.NotConnectedException {
        if (packet instanceof IQ) {
            LOG.info("Received IQ:" + packet.toXML());
        }
    }


    private class AcceptEverythingPacketFilter implements PacketFilter {
        @Override
        public boolean accept(Packet packet) {
            LOG.info("Checking packet:" + packet.toString());
            return true;
        }
    }

 

 

Thanks for any help, I'm not able to determine where the characters are getting lost.


Outcomes