Issue #3290 async onOpen, onClose and onError
Changes after review: + failure to send abnormal close closes connection prior to failing callback. Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
parent
6f7395c8f0
commit
3ad584eaef
|
@ -524,19 +524,22 @@ public class WebSocketChannel implements IncomingFrames, FrameHandler.CoreSessio
|
|||
}
|
||||
catch (Throwable ex)
|
||||
{
|
||||
try
|
||||
if (frame.getOpCode() == OpCode.CLOSE)
|
||||
{
|
||||
CloseStatus closeStatus = CloseStatus.getCloseStatus(frame);
|
||||
if (closeStatus instanceof AbnormalCloseStatus)
|
||||
closeConnection(null, closeStatus, Callback.from(
|
||||
()->callback.failed(ex),
|
||||
x2->
|
||||
{
|
||||
ex.addSuppressed(x2);
|
||||
callback.failed(ex);
|
||||
}));
|
||||
else
|
||||
callback.failed(ex);
|
||||
}
|
||||
else
|
||||
callback.failed(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (frame.getOpCode() == OpCode.CLOSE)
|
||||
{
|
||||
CloseStatus closeStatus = CloseStatus.getCloseStatus(frame);
|
||||
if (closeStatus instanceof AbnormalCloseStatus)
|
||||
closeConnection(null, closeStatus, NOOP);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue