Thanks Anno for you detailed analysis. As far as I can tell it is correct.
But I should maybe start with some background. XMPP requires entities to send a response to an IQ request (there are some exceptions from this rule, e.g. when you want to prevent presence leaks). Before Smack 4.1, this rule was roughly implemented: Every time Smack was not able to parse an IQ request, it would send the required error response, assuming that if it was able to parse the request, then someone would actually take care of it.
This approach had some drawbacks:
- XMPP logic was coupled with parsing. The result was that the parseIQ method was defined with a second parameter besides the obvious XmlPullParser: A XMPPConnection. This connection was used to send the error IQ responses in case Smack was not able to parse the stanza.
- It was not guaranteed that an error result was sent, in case a provider existed but no logic within Smack to handle the IQ request.
- There could be multiple instances handling the requests, resulting in multiple responses
Some time ago, I introduced the concept of IQ request handlers in Smack 4.1. If you want to receive IQ requests, you have to register such a handler. Only one handler can be active for a given IQ request "class". And if no handler is active, Smack would send an error response (if replyToUnknownIq is set).
I did some tests, took a careful look at the code, but unfortunately I missed that the logic in StreamNegotiator broke with the change. The unit tests for file transfer look pretty exhaustive on a first quick look, but it appears they also didn't catched that. I really wish we could resurrect the integration tests in Smack, they probably would had catch that.
I'm currently working on an approach to fix StreamNegoiator. It appears that it will be a quick and dirty hack, because how file transfer is implemented in Smack. And since I'm not happy with the design and implementation of the file transfer API in Smack, I hope that in the long run we'll get proper Jingle file transfers with a new and thoughtful design and implemented API.