Skip to content
This repository was archived by the owner on Mar 20, 2025. It is now read-only.

Commit 775e145

Browse files
committed
Call::terminate: Use sendIq() task instead of manual IQ ack handling
CallPrivate stores all sent jingle requests internally to look for acks and to trigger forceful termination upon the ack to SessionTerminate. This commit replaces this by using the newer sendIq() API and a QXmppTask.
1 parent f4da357 commit 775e145

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/client/QXmppCall.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "QXmppConstants_p.h"
1414
#include "QXmppJingleIq.h"
1515
#include "QXmppStun.h"
16+
#include "QXmppTask.h"
1617
#include "QXmppUtils.h"
1718

1819
#include "StringLiterals.h"
@@ -212,12 +213,6 @@ void QXmppCallPrivate::handleAck(const QXmppIq &ack)
212213
if (request != requests.end()) {
213214
// process acknowledgement
214215
q->debug(u"Received ACK for packet %1"_s.arg(ack.id()));
215-
216-
// handle termination
217-
if (request->action() == QXmppJingleIq::SessionTerminate) {
218-
q->terminated();
219-
}
220-
221216
requests.erase(request);
222217
}
223218
}
@@ -542,9 +537,14 @@ void QXmppCallPrivate::terminate(QXmppJingleIq::Reason::Type reasonType)
542537
iq.setAction(QXmppJingleIq::SessionTerminate);
543538
iq.setSid(sid);
544539
iq.reason().setType(reasonType);
545-
sendRequest(iq);
540+
546541
setState(QXmppCall::DisconnectingState);
547542

543+
manager->client()->sendIq(std::move(iq)).then(q, [this](auto result) {
544+
// terminate on both success or error
545+
q->terminated();
546+
});
547+
548548
// schedule forceful termination in 5s
549549
QTimer::singleShot(5s, q, &QXmppCall::terminated);
550550
}

0 commit comments

Comments
 (0)