powered by Jive Software

Smack 4.2.0 does not call reconnectionSuccessful() anymore. Bug?


#1

When using Smack 4.1.7 the ConnectionListener method reconnectionSuccessful() is called after reconnection.

Now in Smack 4.2.0 this method is never called because the method call notifyReconnection() was removed from XMPPTCPConnection.

Is this a bug?

XMPPTCPConnection.java (4.2.0)

protected void connectInternal() throws SmackException, IOException, XMPPException {

closingStreamReceived.init();

connectUsingConfiguration();

initConnection();

callConnectionConnectedListener();

if (wasAuthenticated) {

login();

notifyReconnection(); // 4.1.7

}

}


#2

Uh, that’s strange. I think you are right. Created [SMACK-775] XMPPTCPConnection does not invoke reconnectionSuccessful() ConnectionListener callback - IgniteRealtime JIRA


#3

Actually I wonder how useful that callback is given that ConnectionListener has connected() and authenticated() callbacks. The “invoke special callback after authenticated when the connection was previously authenticated” mechanism appears to be bloat, so I would eventually remove it.

What do you think?


#4

I agree. If the call of authenticated() with parameter resumed = true is exactly the same as the call of reconnecitonSuccessful() then the reconnecitonSuccessful() method can be removed. I fixed my issue by moving the code from reconnecitonSuccessful() to authenticated() and will test it.


#5

If the call of authenticated() with parameter resumed = true is exactly the same as the call of reconnecitonSuccessful()

Actually they are not the same. The ‘resumed’ parameter of authenticated() refers to stream management resumption. reconnectionSuccessful() was invoked when a previously authenticated connection was successfully reconnected.


#6

So the reconnectionSuccessful() makes sense in order to detect a connection that was initiated automatically by the reconnection manager. In my case I have to fix some things after a connection was resumed after interruption. But for that I can live with authenticated(resumed).