powered by Jive Software

3.3.2 patch: minor session cleanup issue

In 3.3.2, when a client session’s connection closes while the session is still present, I don’t see anything that cleans up the routing table entries for the session. This patch does the cleanup. The trunk code looks fine in this regard, so if no further releases are planned before a release from trunk, this patch can be ignored. I don’t actually have explicit instructions for reproducing problems from the left-over routing table entries (other than a small memory leak). I could even be wrong about them being left over, though if so, I can’t find the code that would remove them.

Index: org/jivesoftware/openfire/SessionManager.java

===================================================================

— org/jivesoftware/openfire/SessionManager.java (revision 9025)

+++ org/jivesoftware/openfire/SessionManager.java (working copy)

@@ -1528,6 +1528,18 @@

// If the user is still available then send an unavailable presence

Presence presence = session.getPresence();

if (presence.isAvailable()) {

  •           // Clean up routes we added when the user came available. Note that this
    
  •           // **doesn't** dispatch an event via PresenceEventDispatcher. If you instead
    
  •           // called session.setPresence(), then that would fire the event, which
    
  •           // would be inappropriate after dispatching
    
  •           // SessionEventDispatcher.EventType.session_destroyed, though fine if ordered
    
  •           // earlier. (If the Presence packet was synthesized before removing the
    
  •           // session from sessions, it wouldn't even be necessary to call setPresence())
    
  •           // Not dispatching the event is consistent with trunk which just removes the
    
  •           // routes directly from within this function.
    
  •           //
    
  •           sessionUnavailable(session);
    

Presence offline = new Presence();

offline.setFrom(session.getAddress());

offline.setTo(new JID(null, serverName, null));