Expose the isInputOpen() method in CoreSession interface.

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2021-08-18 11:00:39 +10:00
parent 38a2d04d67
commit d3dfe353be
2 changed files with 19 additions and 0 deletions

View File

@ -110,6 +110,11 @@ public interface CoreSession extends OutgoingFrames, Configuration
*/
SocketAddress getRemoteAddress();
/**
* @return True if the websocket is open inbound
*/
boolean isInputOpen();
/**
* @return True if the websocket is open outbound
*/
@ -253,6 +258,12 @@ public interface CoreSession extends OutgoingFrames, Configuration
return null;
}
@Override
public boolean isInputOpen()
{
return true;
}
@Override
public boolean isOutputOpen()
{

View File

@ -183,6 +183,12 @@ public class WebSocketCoreSession implements IncomingFrames, CoreSession, Dumpab
return getConnection().getEndPoint().getRemoteSocketAddress();
}
@Override
public boolean isInputOpen()
{
return sessionState.isInputOpen();
}
@Override
public boolean isOutputOpen()
{
@ -416,8 +422,10 @@ public class WebSocketCoreSession implements IncomingFrames, CoreSession, Dumpab
{
if (!demanding)
throw new IllegalStateException("FrameHandler is not demanding: " + this);
if (!sessionState.isInputOpen())
throw new IllegalStateException("FrameHandler input not open: " + this);
connection.demand(n);
}