flushQpackDecoderInstructions method

Future<int?> flushQpackDecoderInstructions()

Flush pending QPACK decoder instructions to the decoder stream.

Returns the stream ID if instructions were sent, or null if the buffer was empty.

Implementation

Future<int?> flushQpackDecoderInstructions() async {
  if (_pendingDecoderInstructions.isEmpty) return null;
  final instructions =
      List<DecoderInstruction>.from(_pendingDecoderInstructions);
  _pendingDecoderInstructions.clear();
  final builder = BytesBuilder();
  for (final instruction in instructions) {
    builder.add(instruction.serialize());
  }
  if (_decoderStreamId == null) {
    await openQpackStreams();
  }
  return _openUnidirectionalStream(
    StreamType.qpackDecoder,
    Uint8List.fromList(builder.toBytes()),
  );
}