This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch feature/notificationSupport
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git

commit 4f1b37ca47d11d07ee06cce2c67384e4f202b358
Author: Sebastian Rühl <sru...@apache.org>
AuthorDate: Thu May 24 13:33:46 2018 +0200

    fixed bug where we remove a mapping too early
---
 .../org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java
 
b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java
index a56ad39..a32727e 100644
--- 
a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java
+++ 
b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java
@@ -188,7 +188,7 @@ public class AdsTcpPlcConnection extends 
AdsAbstractPlcConnection implements Plc
                     .forEach(adsNotificationSample -> {
                         Consumer<? extends PlcNotification> 
plcNotificationConsumer = 
handleConsumerMap.get(adsNotificationSample.getNotificationHandle());
                         if (plcNotificationConsumer == null) {
-                            LOGGER.warn("Unmapped notification received ", 
adsNotificationSample.getNotificationHandle());
+                            LOGGER.warn("Unmapped notification received {}", 
adsNotificationSample);
                             return;
                         }
                         Data data = adsNotificationSample.getData();
@@ -210,7 +210,6 @@ public class AdsTcpPlcConnection extends 
AdsAbstractPlcConnection implements Plc
         Pair<Consumer<AdsDeviceNotificationRequest>, NotificationHandle> 
handlePair = subscriberMap.remove(Pair.of(consumer, address));
         if (handlePair != null) {
             NotificationHandle notificationHandle = handlePair.getRight();
-            handleConsumerMap.remove(notificationHandle);
             AdsDeleteDeviceNotificationRequest 
adsDeleteDeviceNotificationRequest = AdsDeleteDeviceNotificationRequest.of(
                 targetAmsNetId,
                 targetAmsPort,
@@ -229,6 +228,7 @@ public class AdsTcpPlcConnection extends 
AdsAbstractPlcConnection implements Plc
             }
 
             
getChannel().pipeline().get(Plc4x2AdsProtocol.class).removeConsumer(handlePair.getLeft());
+            handleConsumerMap.remove(notificationHandle);
         }
     }
 }

-- 
To stop receiving notification emails like this one, please contact
sru...@apache.org.

Reply via email to