kevin1986xu / asmack

Automatically exported from code.google.com/p/asmack
Other
0 stars 0 forks source link

Connection.addConnectionListener should not check for connected state #56

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
.smack.Connection.addConnectionListener() checks if the connection is already 
connected - and refuses to add the listener if it isn't. I believe this 
behaviour is problematic, because it won't catch cases where a connection is 
dropped immediately after being connected.

Furthermore, this doesn't match what the other add*Listener()s do. They accept 
a listener just fine, even if the connection isn't active yet.

If a connection is terminated and reopened later, the listener is still 
registered (and will catch disconnects immediately), so I don't see any benefit 
at all in checking for isConnected().

Can you clarify why it is necessary?

Original issue reported on code.google.com by onit...@gmail.com on 13 May 2011 at 2:29