add comment in the PerMessageDeflateExtension IncomingFlusher
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
81447c3e2c
commit
212ea5e6f8
|
@ -464,6 +464,11 @@ public class PerMessageDeflateExtension extends AbstractExtension implements Dem
|
|||
chunk.setPayload(payload);
|
||||
chunk.setFin(frame.isFin() && complete);
|
||||
|
||||
// If we are complete we return true, then DemandingFlusher.process() will null out the Frame and Callback.
|
||||
// The application may decide to hold onto the buffer and delay completing the callback, so we need to capture
|
||||
// references to these in the payloadCallback and not rely on state of the flusher which may have moved on.
|
||||
// This flusher could be failed while the application already has the payloadCallback, so we need protection against
|
||||
// the flusher failing and the application completing the callback, that's why we use the payload AtomicReference.
|
||||
boolean completeCallback = complete;
|
||||
AtomicReference<ByteBuffer> payloadRef = _payloadRef;
|
||||
Callback payloadCallback = Callback.from(() ->
|
||||
|
|
Loading…
Reference in New Issue