Bug: Openfire doesn''t always send </stream> after receiving </stream>

Issue:

The server does not always send out a closing stream element if a closing stream element was sent to Openfire by the client.

Cause:

in NIOConnection#close(), two things are done: first, the session gets closed. Then the String that makes up the closing stream element gets sent. Sadly, the method that is used to deliver that String to the client (NIOConnection#deliverRawText()) returns without doing something if the session is closed - which we just did.

Possible fix:

First send out the element, then close the session, instead of the other way around.

In theory, this could keep the connection open long enough for more text to be sent (after the ) before the session gets closed. Is that going to be a problem?

Message was edited by: Guus

I added a JUnit 3.8 Testcase that looks for the desired behavior. The testcase requires Smack.

Hey Guus,

You have a test in here, testAllResourcesReceiveStreamEndElement. Is that behavior supposed to occur when a client sends a stream close? If so, I had heard of it before and was just checking the RFCs for it…

Thanks,

Alex

Alex, sorry for confusing you. I was mixing up two separate issues (the other one being the deregistration issue that I mentioned earlier today). I adjusted the code in this thread.

Gato fixed it as JM-1154.