Patch for reconnect logic

Hello,

I noticed that the 2.6.3 version of Spark usually doesn’t reconnect to myJabber server after a network outage, even after numerous attempts. In most cases, the server is returning a 409 error as it hasn’t noticed the previous connection has closed.

I did some debugging of the smack library and found that the reconnection logic was struggling with the fact that it can recreate the TCP socket, but then receives a 409 at login. After a few attempts it actually manages to create multiple instance of the ReconnectionManager class,with multiple threads all trying to reconnect. Once in this state, it seems to never recover.

I’ve attached a smack patch that seems to resolve the issue without being too intrusive, but I suspect there is more elegant solution. Probably one that isn’t specific to the 409 error as well as prevents the creation of multipleReconnectionManager classes.

Chris
Reconnection_fixes.patch.zip (3037 Bytes)

Logged as SMACK-393.

Thanks for the patch.