summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2018-06-20 15:01:35 +0900
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-06-20 16:38:04 +0900
commit98bd303d934b804c90cb236a4ae1775f0cf95826 (patch)
tree3556f8c888274a44de3f4c8b49cc45ead93d73c8
parent21d6531e457a3c405725a88c42f525425d0831bf (diff)
downloadsubsurface-98bd303d934b804c90cb236a4ae1775f0cf95826.tar.gz
qt-ble: purge pending read data when writing
This should never happen, since our interface is bassically synchronous, but it could happen with delayed replies that came in just after we decided to re-transmit a command. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--core/qt-ble.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/qt-ble.cpp b/core/qt-ble.cpp
index 7556b01f8..2d1de1408 100644
--- a/core/qt-ble.cpp
+++ b/core/qt-ble.cpp
@@ -155,6 +155,9 @@ dc_status_t BLEObject::write(const void *data, size_t size, size_t *actual)
if (!receivedPackets.isEmpty()) {
qDebug() << ".. write HIT with still incoming packets in queue";
+ do {
+ receivedPackets.takeFirst();
+ } while (!receivedPackets.isEmpty());
}
QList<QLowEnergyCharacteristic> list = preferredService()->characteristics();