From c16c867bdc38137a9fb7d1431ad1978a7e398b56 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Fri, 21 Jul 2017 11:26:18 +0300 Subject: [PATCH] Not remove from queue when connection is lost --- .../src/net/osmand/plus/monitoring/LiveMonitoringHelper.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/monitoring/LiveMonitoringHelper.java b/OsmAnd/src/net/osmand/plus/monitoring/LiveMonitoringHelper.java index 784d9e96ea..8a4a13a081 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/LiveMonitoringHelper.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/LiveMonitoringHelper.java @@ -118,9 +118,11 @@ public class LiveMonitoringHelper { while (isLiveMonitoringEnabled()) { for (ConcurrentLinkedQueue queue : concurrentLinkedQueues) { if (!queue.isEmpty()) { - LiveMonitoringData data = (LiveMonitoringData) queue.poll(); + LiveMonitoringData data = (LiveMonitoringData) queue.peek(); if (!(System.currentTimeMillis() - data.time > settings.LIVE_MONITORING_MAX_INTERVAL_TO_SEND.get())) { sendData(data); + } else { + queue.poll(); } } } @@ -197,6 +199,7 @@ public class LiveMonitoringHelper { urlConnection.getResponseMessage(); log.error("Error sending monitor request: " + msg); } else { + queue.poll(); InputStream is = urlConnection.getInputStream(); StringBuilder responseBody = new StringBuilder(); if (is != null) {