474936 - WebSocketSessions are not always cleaned out from openSessions
+ Calling onSessionOpen() before App.onOpen() This helps, as there is a race for the onSessionOpen() in the original behavior with short lived sockets. The short lived socket could handle onSessionClosed() before onSessionOpen() had a chance, making the close fail to remove the session from openSessions, and then the slower add occurs later, adding it into the openSession + Minor cleanup in IOState
This commit is contained in:
parent
1bca608b48
commit
f22fcde971
|
@ -400,12 +400,14 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Web
|
||||||
// confirmed close of local endpoint
|
// confirmed close of local endpoint
|
||||||
notifyClose(close.getStatusCode(),close.getReason());
|
notifyClose(close.getStatusCode(),close.getReason());
|
||||||
break;
|
break;
|
||||||
case OPEN:
|
case CONNECTED:
|
||||||
// notify session listeners
|
// notify session listeners
|
||||||
for (SessionListener listener : sessionListeners)
|
for (SessionListener listener : sessionListeners)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (LOG.isDebugEnabled())
|
||||||
|
LOG.debug("{}.onSessionOpen()", listener.getClass().getSimpleName());
|
||||||
listener.onSessionOpened(this);
|
listener.onSessionOpened(this);
|
||||||
}
|
}
|
||||||
catch (Throwable t)
|
catch (Throwable t)
|
||||||
|
|
|
@ -251,14 +251,15 @@ public class IOState
|
||||||
{
|
{
|
||||||
closeInfo = close;
|
closeInfo = close;
|
||||||
|
|
||||||
|
// Turn off further output
|
||||||
|
outputAvailable = false;
|
||||||
|
|
||||||
boolean in = inputAvailable;
|
boolean in = inputAvailable;
|
||||||
boolean out = outputAvailable;
|
boolean out = outputAvailable;
|
||||||
if (closeHandshakeSource == CloseHandshakeSource.NONE)
|
if (closeHandshakeSource == CloseHandshakeSource.NONE)
|
||||||
{
|
{
|
||||||
closeHandshakeSource = CloseHandshakeSource.LOCAL;
|
closeHandshakeSource = CloseHandshakeSource.LOCAL;
|
||||||
}
|
}
|
||||||
out = false;
|
|
||||||
outputAvailable = false;
|
|
||||||
|
|
||||||
LOG.debug("onCloseLocal(), input={}, output={}",in,out);
|
LOG.debug("onCloseLocal(), input={}, output={}",in,out);
|
||||||
|
|
||||||
|
@ -320,14 +321,15 @@ public class IOState
|
||||||
|
|
||||||
closeInfo = close;
|
closeInfo = close;
|
||||||
|
|
||||||
|
// turn off further input
|
||||||
|
inputAvailable = false;
|
||||||
|
|
||||||
boolean in = inputAvailable;
|
boolean in = inputAvailable;
|
||||||
boolean out = outputAvailable;
|
boolean out = outputAvailable;
|
||||||
if (closeHandshakeSource == CloseHandshakeSource.NONE)
|
if (closeHandshakeSource == CloseHandshakeSource.NONE)
|
||||||
{
|
{
|
||||||
closeHandshakeSource = CloseHandshakeSource.REMOTE;
|
closeHandshakeSource = CloseHandshakeSource.REMOTE;
|
||||||
}
|
}
|
||||||
in = false;
|
|
||||||
inputAvailable = false;
|
|
||||||
|
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("onCloseRemote(), input={}, output={}",in,out);
|
LOG.debug("onCloseRemote(), input={}, output={}",in,out);
|
||||||
|
|
Loading…
Reference in New Issue