From 88ac816393d30014df62819fd36f1d78a1c5729d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=B6hler?= Date: Tue, 5 Feb 2019 18:46:54 +0100 Subject: [PATCH] Fix queue handling if only server or client operation is present --- .../gadgetbridge/service/btle/BtLEQueue.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/BtLEQueue.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/BtLEQueue.java index 28b9e16ab..9f8da69f6 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/BtLEQueue.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/BtLEQueue.java @@ -88,12 +88,13 @@ public final class BtLEQueue { while (!mDisposed && !mCrashed) { try { - LOG.info("waiting..."); - synchronized (mTransactionMonitor) { - try { - mTransactionMonitor.wait(); - } catch (InterruptedException e) { - e.printStackTrace(); + if(mTransactions.isEmpty() && mServerTransactions.isEmpty()) { + synchronized (mTransactionMonitor) { + try { + mTransactionMonitor.wait(); + } catch (InterruptedException e) { + e.printStackTrace(); + } } } Transaction transaction = mTransactions.poll();