ensure callback is always completed in WebSocketCoreSession
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
1e0c0b42ab
commit
6b20ee0753
|
@ -317,12 +317,22 @@ public class WebSocketCoreSession implements CoreSession, Dumpable
|
||||||
|
|
||||||
CloseStatus closeStatus = new CloseStatus(code, cause);
|
CloseStatus closeStatus = new CloseStatus(code, cause);
|
||||||
if (CloseStatus.isTransmittableStatusCode(code))
|
if (CloseStatus.isTransmittableStatusCode(code))
|
||||||
|
{
|
||||||
close(closeStatus, callback);
|
close(closeStatus, callback);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (sessionState.onClosed(closeStatus))
|
if (sessionState.onClosed(closeStatus))
|
||||||
|
{
|
||||||
closeConnection(closeStatus, callback);
|
closeConnection(closeStatus, callback);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We are already closed because of a previous failure.
|
||||||
|
// Succeed because failing might re-enter this branch if it's the Frame callback.
|
||||||
|
callback.succeeded();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue