class Http2Session
source · line 9public class Http2Session private constructor(private var handle: ULong,
/**
* The fixed client/server role of this codec.
*/
public val role: HttpRole) : Closeable
- Supertype
Closeable - Inherited
fun dispose(): Unit· Closeable
An owned in-memory HTTP/2 session. Serialize calls, drain events and output, and acknowledge received DATA only after consumption. It owns no network transport.
function goAway
source · line 249public fun goAway(code: UInt = 0U, debugData: List<Byte> = ArrayList<Byte>(), lastStreamId: Int? = None): Unit
Queues GOAWAY with optional debug bytes and last accepted stream ID; output still needs to be drained.
parameter code
source · line 249code: UInt = 0U
parameter lastStreamId
source · line 249lastStreamId: Int? = None
parameter debugData
source · line 249debugData: List<Byte> = ArrayList<Byte>()
function takeOutputChunk
source · line 152public fun takeOutputChunk(buffer: NativeByteBuffer, count: Long = buffer.writableBytes): Http2OutputChunk
Copies an output chunk and returns its byte count, stream ID, and category.
parameter buffer
source · line 152buffer: NativeByteBuffer
parameter count
source · line 152count: Long = buffer.writableBytes
function submitRequest
source · line 176public fun submitRequest(head: HttpRequestHead, endStream: Boolean = true): Int
Queues a request and returns its new stream ID. Set endStream=false before writing a body or trailers.
parameter head
source · line 176head: HttpRequestHead
parameter endStream
source · line 176endStream: Boolean = true
function submitResponse
source · line 191public fun submitResponse(streamId: Int, head: HttpResponseHead, endStream: Boolean = true): Unit
Queues response headers for a stream; set endStream=false when body or trailers follow.
parameter head
source · line 191head: HttpResponseHead
parameter streamId
source · line 191streamId: Int
parameter endStream
source · line 191endStream: Boolean = true
function endInput
source · line 264public fun endInput(): Unit
Reports transport EOF and validates whether the protocol input ended cleanly.
function consume
source · line 233public fun consume(streamId: Int, count: Long): Unit
Acknowledges DATA bytes actually read or discarded by the application so flow-control credit can be returned.
parameter count
source · line 233count: Long
parameter streamId
source · line 233streamId: Int
function takeOutput
source · line 146public fun takeOutput(buffer: NativeByteBuffer, count: Long = buffer.writableBytes): Long
Copies up to count outgoing bytes into the writable buffer and advances its writer position.
parameter count
source · line 146count: Long = buffer.writableBytes
parameter buffer
source · line 146buffer: NativeByteBuffer
property bufferedOutputBytes
source · line 85public val bufferedOutputBytes: Long
get: public read-only
The currently buffered output byte count.
getter get
source · line 85get(): Long
function receive
source · line 117public fun receive(buffer: NativeByteBuffer, count: Long = buffer.readableBytes): Long
Consumes up to count readable input bytes, advancing the buffer by the returned count. Drain queued events after feeding input.
parameter count
source · line 117count: Long = buffer.readableBytes
parameter buffer
source · line 117buffer: NativeByteBuffer
property isClosed
source · line 73public val isClosed: Boolean
get: public read-only
Whether its state has been released.
getter get
source · line 73get(): Boolean
function reset
source · line 240public fun reset(streamId: Int, code: UInt = 8U): Unit
Queues RST_STREAM and abandons the stream's unconsumed body; the default code is CANCEL.
parameter streamId
source · line 240streamId: Int
parameter code
source · line 240code: UInt = 8U
function finish
source · line 220public fun finish(streamId: Int, trailers: List<HttpField> = ArrayList<HttpField>()): Unit
Ends this stream's outgoing body, optionally with trailers; queued bytes still need to be drained.
parameter streamId
source · line 220streamId: Int
parameter trailers
source · line 220trailers: List<HttpField> = ArrayList<HttpField>()
property wantsRead
source · line 77public val wantsRead: Boolean
get: public read-only
Whether the session currently expects further peer input.
getter get
source · line 77get(): Boolean
property wantsWrite
source · line 81public val wantsWrite: Boolean
get: public read-only
Whether the backend currently has output work to drive.
getter get
source · line 81get(): Boolean
function nextEvent
source · line 269public fun nextEvent(): Http2Event?
Removes the next queued event, or returns None when none is ready.
function close
source · line 281public override fun close(): Unit
- Overrides
close
Releases codec state without sending, finishing, or closing a transport.
property role
source · line 13public val role: HttpRole
get: public read-only
The fixed client/server role of this codec.
function receiveWithProgress
source · line 123public fun receiveWithProgress(buffer: NativeByteBuffer, count: Long = buffer.readableBytes): Http2ReceiveResult
Consumes input and returns total and per-stream input progress for this call.
parameter buffer
source · line 123buffer: NativeByteBuffer
parameter count
source · line 123count: Long = buffer.readableBytes
function writeBody
source · line 203public fun writeBody(streamId: Int, buffer: NativeByteBuffer, count: Long = buffer.readableBytes): Long
Queues body bytes and advances by the accepted count. Short writes or zero require draining output and/or receiving window updates.
parameter buffer
source · line 203buffer: NativeByteBuffer
parameter count
source · line 203count: Long = buffer.readableBytes
parameter streamId
source · line 203streamId: Int
function hasPendingOutput
source · line 90public fun hasPendingOutput(streamId: Int): Boolean
Tests whether the specified positive stream ID still has queued output.
parameter streamId
source · line 90streamId: Int