remove duplicate code in current()

This commit is contained in:
Daniel Jelinski 2026-01-30 09:59:10 +01:00
parent 52230a4858
commit 4ffa3e48c6

View File

@ -301,27 +301,16 @@ final class Http3ServerStreamImpl {
ByteBuffer current;
ByteBuffer current() throws IOException {
Object reason = closeReason.get();
if (reason != null) {
if (reason == Boolean.TRUE) {
throw new IOException("Stream is closed");
} else {
throw new IOException((IOException)reason);
}
}
while (true) {
if (current != null && current.hasRemaining()) {
return current;
}
if (current == QuicStreamReader.EOF) {
reason = closeReason.get();
if (reason != null) {
if (reason == Boolean.TRUE) {
throw new IOException("Stream is closed");
} else {
throw new IOException((IOException)reason);
}
Object reason = closeReason.get();
if (reason != null) {
if (reason == Boolean.TRUE) {
throw new IOException("Stream is closed");
} else {
throw new IOException((IOException)reason);
}
}
if (current != null && (current.hasRemaining() || current == QuicStreamReader.EOF)) {
return current;
}
try {