From 11a0af384ff12e96827a08dd378c7b1830c31790 Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Tue, 8 Sep 2020 17:31:34 +0200 Subject: QXmppClient: Reset Stream Management package cache on JID changes The stream management mechanisms cache sent packages until the client receives an acknowledgement from the server. When the connection gets lost, the client resends all packages from the last connection that have not been acknowledged. And here comes the problem: When connecting with a different JID, the client still resends all packages from the last connection. Packages that were never intended to be sent from another account / to another server. This commit fixes this behaviour by resetting the package cache, when the JID changes. --- src/base/QXmppStream.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/base/QXmppStream.cpp') diff --git a/src/base/QXmppStream.cpp b/src/base/QXmppStream.cpp index 3c640b03..bffaf4c7 100644 --- a/src/base/QXmppStream.cpp +++ b/src/base/QXmppStream.cpp @@ -165,6 +165,19 @@ bool QXmppStream::sendPacket(const QXmppStanza &packet) return success; } +/// +/// Resets the stream management packages cache. +/// +/// This can be done to prevent that packages from the last connection are being +/// resent. +/// +/// \since QXmpp 1.4 +/// +void QXmppStream::resetPacketCache() +{ + d->streamManager.resetCache(); +} + /// /// Returns the QSslSocket used for this stream. /// -- cgit v1.2.3