From 966f5f09ec7b33d0f400a522b2990952370e97a1 Mon Sep 17 00:00:00 2001 From: Mike Toon Date: Mon, 11 Nov 2019 10:49:49 +0000 Subject: [PATCH] BLOCKS: Only update ping sent time when pings are sent --- .../topology/internal/juce_BlockImplementation.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/juce_blocks_basics/topology/internal/juce_BlockImplementation.cpp b/modules/juce_blocks_basics/topology/internal/juce_BlockImplementation.cpp index 7d186589a3..45dc0c07bb 100644 --- a/modules/juce_blocks_basics/topology/internal/juce_BlockImplementation.cpp +++ b/modules/juce_blocks_basics/topology/internal/juce_BlockImplementation.cpp @@ -220,10 +220,7 @@ public: bool sendMessageToDevice (const PacketBuilder& builder) { if (detector != nullptr) - { - lastMessageSendTime = Time::getCurrentTime(); return detector->sendMessageToDevice (uid, builder); - } return false; } @@ -457,7 +454,7 @@ public: void pingFromDevice() { - lastMessageReceiveTime = Time::getCurrentTime(); + lastPingReceiveTime = Time::getCurrentTime(); } MIDIDeviceConnection* getDeviceConnection() @@ -511,8 +508,11 @@ public: remoteHeap.sendChanges (*this, false); - if (lastMessageSendTime < Time::getCurrentTime() - getPingInterval()) + if (lastPingSendTime < Time::getCurrentTime() - getPingInterval()) + { + lastPingSendTime = Time::getCurrentTime(); sendCommandMessage (BlocksProtocol::ping); + } } RelativeTime getPingInterval() @@ -654,7 +654,7 @@ public: RemoteHeapType remoteHeap; WeakReference detector; - Time lastMessageSendTime, lastMessageReceiveTime; + Time lastPingSendTime, lastPingReceiveTime; BlockConfigManager config; std::function configChangedCallback;