Skip to content

Make ModularXmppClientToServerConnection non-final#697

Closed
MarcelHeckel wants to merge 1 commit intoigniterealtime:masterfrom
MarcelHeckel:master
Closed

Make ModularXmppClientToServerConnection non-final#697
MarcelHeckel wants to merge 1 commit intoigniterealtime:masterfrom
MarcelHeckel:master

Conversation

@MarcelHeckel
Copy link
Contributor

We need to override the method AbstractXMPPConnection.parseAndProcessStanza() to add some functionality to the XmlPullParser. This is possible with XMPPBOSHConnection and XMPPTCPConnection.

The same flexibility is needed in ModularXmppClientToServerConnection, but it is final, so we cannot override the method. Personally, I see no good reason why this class is final.

@Flowdalic
Copy link
Member

Thanks for your contribution. Much appreciated.

We need to override the method AbstractXMPPConnection.parseAndProcessStanza() to add some functionality to the XmlPullParser.

Could you elaborate a bit on what you are trying to achieve?

@MarcelHeckel
Copy link
Contributor Author

The main problem is that we can have large stanzas combined with slow internet connections.
This causes getLastStanzaReceived() to be too far in the past and the PingManager to close the connection.
Therefore, we have an XmlPullParser implementation that delegates to the real XmlPullParser and sets lastStanzaReceived to the current timestamp every time an XML element is read. This way, the PingManager will not disconnect the connections, as the tags of the large stanza occur much more frequently than the end of the stanza.

@Flowdalic
Copy link
Member

Seems what you really need is XMPPConnection.getLastDataReceived() and PingManager using that. I'll have a look.

@MarcelHeckel
Copy link
Contributor Author

@Flowdalic I could make a implementation of getLastDataReceived() based on our solution, if you like.

Flowdalic added a commit to Flowdalic/Smack that referenced this pull request Feb 23, 2026
We had a user report that the timestamp obtained via
getLastStanzaReceived() may bee too far in the past when large stanzas
are received over slow internet connections [1]. Therefore, PingManger
now uses this new API to obtain a potentially more fine-grained
timestamp regarding incoming data.

1: igniterealtime#697 (comment)
@Flowdalic
Copy link
Member

@Flowdalic I could make a implementation of getLastDataReceived() based on our solution, if you like.

See #698

@MarcelHeckel
Copy link
Contributor Author

Looks good!

@MarcelHeckel MarcelHeckel deleted the master branch February 25, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants