Skip to content

Commit

Permalink
fix: isIdle now returns true when channel open but not connected
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexGidman committed Jun 29, 2023
1 parent ccbec46 commit 878fbc9
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 878fbc9

Please sign in to comment.