powered by Jive Software

What happens if login fails

I am currently looking for possible leaks in my code and i’ve been going in circles … which leads me to my question … I’m just wondering …

What happens when the login fails due to some reason (Bad Username, Bad Password, etc) ?

Cuz the TransportSession was already added into the Sessionmanager even before the session was authenticated since the login was being done by a separate thread.

session = this.registrationLoggedIn(registration, from, getPresenceType(packet), packet.getStatus(), packet.getPriority());

sessionManager.storeSession(from, session);

So far I’ve been looking at the code and I don’t see anything that removes the errant session from the session manager in case it fails to login.

So, Did I miss something?

Thanks in advance!

Ok, I found the SessionReaper TimerTask that does the cleanupOrphanedSessions() … I think that’s the one responsible for cleaning up the errant TransportSession. Only thing is that it will have to wait till the user has logged out.

However, I am a bit uncomfortable with having only a TimerTask to ensure the GC is carried out properly. I’d appreciate any views on this.

A failed login calls sessionDisconnectedNoReconnect in TransportSession which cleans up the session appropriately. The SessionReaper really doesn’t get a lot of action, it’s just there as a failsafe. Like in case, for whatever reason, Openfire didn’t tell the IM Gateway plugin that the XMPP session went away.

Hmmm. In the YahooSession the only time sessionDisconnectedNoReconnect was ever called was in the logOut method. Which was NEVER called when yahoo fails to login in the catched Exceptions inside the login method.

Unless connectionClosed on the listener is called. I don’t know for certain that it does get called so you might be quite right, I might have missed that. Have you already verified that connectionClosed is most definitely not being called in those instances and that you have a leftover session sitting around after those events?