Skip to content

Commit

Permalink
H3: release the buffer when the stream is closing
Browse files Browse the repository at this point in the history
Signed-off-by: Ludovic Orban <[email protected]>
  • Loading branch information
lorban committed Jun 6, 2023
1 parent 15d67bd commit 4456f99
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,14 @@ private void processDataFrames(boolean setFillInterest)
case FRAME ->
{
action.getAndSet(null).run();
// Do not release the buffer here to avoid races with
// user-spawned threads that may call Stream.read().
// Do not release the buffer before the stream started closing
// to avoid races with user-spawned threads that may call Stream.read().
if (remotelyClosed)
{
// The last frame may have caused a write that we need to flush.
getEndPoint().getQuicSession().flush();
tryReleaseBuffer(false);
}
}
}
}
Expand Down Expand Up @@ -213,9 +219,6 @@ private void processNonDataFrames()
// From now on it's the application that drives
// demand, reads, parse+fill and fill interest.
return;

// TODO: do we loop here?
// There might be a trailer, loop around.
}
default -> throw new IllegalStateException("unknown message parser result: " + result);
}
Expand Down

0 comments on commit 4456f99

Please sign in to comment.