diff --git a/core/src/main/java/org/eclipse/hono/util/HonoProtonHelper.java b/core/src/main/java/org/eclipse/hono/util/HonoProtonHelper.java index a3b5777c00..fc9bbfe2f3 100644 --- a/core/src/main/java/org/eclipse/hono/util/HonoProtonHelper.java +++ b/core/src/main/java/org/eclipse/hono/util/HonoProtonHelper.java @@ -154,6 +154,8 @@ public static void setDefaultCloseHandler(final ProtonSession session) { /** * Checks if a link is established. + *
+ * Note that this only applies to a link which has originally been created by the local peer. * * @param link The link to check. * @return {@code true} if the link has been established. @@ -178,16 +180,28 @@ public static boolean isLinkOpenAndConnected(final ProtonLink> link) { if (link != null && link.isOpen()) { if (link.getSession() != null && link.getSession().getConnection() != null && !link.getSession().getConnection().isDisconnected()) { - return true; + return true; } - final String localLinkAddress = link instanceof ProtonSender ? link.getTarget().getAddress() - : link.getSource().getAddress(); - LOG.debug("{} link [address: {}] is locally open but underlying transport is disconnected", - link instanceof ProtonSender ? "sender" : "receiver", localLinkAddress); + LOG.debug("{} link [source: {}, target: {}] is locally open but underlying transport is disconnected", + link instanceof ProtonSender ? "sender" : "receiver", getRemoteOrLocalSourceAddress(link), getRemoteOrLocalTargetAddress(link)); } return false; } + private static String getRemoteOrLocalSourceAddress(final ProtonLink> link) { + if (link != null && link.getRemoteSource() != null) { + return link.getRemoteSource().getAddress(); + } + return link != null && link.getSource() != null ? link.getSource().getAddress() : null; + } + + private static String getRemoteOrLocalTargetAddress(final ProtonLink> link) { + if (link != null && link.getRemoteTarget() != null) { + return link.getRemoteTarget().getAddress(); + } + return link != null && link.getTarget() != null ? link.getTarget().getAddress() : null; + } + /** * Executes some code on a given context. * diff --git a/site/homepage/content/release-notes.md b/site/homepage/content/release-notes.md index 925dd54ce5..ef4e0e9f24 100644 --- a/site/homepage/content/release-notes.md +++ b/site/homepage/content/release-notes.md @@ -10,6 +10,8 @@ description = "Information about changes in recent Hono releases. Includes new f * The Quarkus based Command Router native image failed to start an embedded cache that was configured to persist data to the local file system. This has been fixed. +* The delivery of a command message sent to an AMQP device potentially didn't get settled if the connection to the + AMQP device got disconnected. This has been fixed. ## 1.7.1