From a3c0d9881a41c24b09811f36fde9a4a169e0d872 Mon Sep 17 00:00:00 2001 From: Robinson Date: Fri, 30 Apr 2021 14:26:04 +0200 Subject: [PATCH] Fixed unnecessary errors when calling "connection.close()" from inside an RMI method. --- src/dorkbox/network/connection/EndPoint.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/dorkbox/network/connection/EndPoint.kt b/src/dorkbox/network/connection/EndPoint.kt index e32b7467..d3525eea 100644 --- a/src/dorkbox/network/connection/EndPoint.kt +++ b/src/dorkbox/network/connection/EndPoint.kt @@ -516,6 +516,15 @@ internal constructor(val type: Class<*>, internal val config: Configuration) : A continue } + + if (result == Publication.CLOSED && connection.isClosedViaAeron()) { + // this can happen when we use RMI to close a connection. RMI will (in most cases) ALWAYS send a response when it's + // done executing. If the connection is *closed* first (because an RMI method closed it), then we will not be able to + // send the message. + // NOTE: we already know the connection is closed. we closed it (so it doesn't make sense to emit an error about this) + return + } + // more critical error sending the message. we shouldn't retry or anything. val errorMessage = "[${publication.sessionId()}] Error sending message. $message (${errorCodeName(result)})"