From 878fbc9b56ce6cc81bc67dd3436b380f10664da4 Mon Sep 17 00:00:00 2001 From: Alex Gidman Date: Thu, 29 Jun 2023 14:23:09 +0100 Subject: [PATCH] fix: isIdle now returns true when channel open but not connected --- .../openfire/spi/NettyConnectionAcceptor.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xmppserver/src/main/java/org/jivesoftware/openfire/spi/NettyConnectionAcceptor.java b/xmppserver/src/main/java/org/jivesoftware/openfire/spi/NettyConnectionAcceptor.java index 04572d98e1..1b58cf085d 100644 --- a/xmppserver/src/main/java/org/jivesoftware/openfire/spi/NettyConnectionAcceptor.java +++ b/xmppserver/src/main/java/org/jivesoftware/openfire/spi/NettyConnectionAcceptor.java @@ -25,9 +25,10 @@ /** * This class is responsible for accepting new (socket) connections, using Java NIO implementation provided by the - * Apache MINA framework. + * Netty framework. * - * @author Guus der Kinderen, guus.der.kinderen@gmail.com + * @author Matthew Vivian + * @author Alex Gidman */ class NettyConnectionAcceptor extends ConnectionAcceptor { // NioEventLoopGroup is a multithreaded event loop that handles I/O operation. @@ -202,13 +203,14 @@ public static void shutdownEventLoopGroups() { } /** - * Determines if this instance is currently in a state where it is actively serving connections. + * Determines if this instance is currently in a state where it is actively serving connections or not. + * Channel must be open with no connections if it is idle * * @return false when this instance is started and is currently being used to serve connections (otherwise true) */ @Override public synchronized boolean isIdle() { - return mainChannel.isActive(); + return mainChannel.isOpen() && !mainChannel.isActive(); } @Override