Describe the bug
The blocking read on istream.read() can cause delays in reaching the onClose callback when a close command is issued externally.
try {
while (!isClosing() && !isClosed() && (readBytes = istream.read(rawbuffer)) != -1) {
engine.decode(ByteBuffer.wrap(rawbuffer, 0, readBytes));
}
engine.eot();
} catch (IOException e) {
handleIOException(e);
} catch (RuntimeException e) {
// this catch case covers internal errors only and indicates a bug in this websocket implementation
onError(e);
engine.closeConnection(CloseFrame.ABNORMAL_CLOSE, e.getMessage());
}
To Reproduce
Steps to reproduce the behavior:
1.connect
2.send
3.close (server delay send any data)
Example application to reproduce the issue
Expected behavior
onclose no delay
Debug log
Environment(please complete the following information):
Additional context