RemotePacketStream

class RemotePacketStream(val address: RemoteAddress, limits: RemoteLimits = RemotePacket.limits, send: (ByteArray) -> Unit) : AutoCloseable(source)

Execution-owner-confined ordering boundary for one host incarnation across asynchronous proxy message events. Retains at most the negotiated pending bytes and entry count; gaps expire on monotonic adapter ticks. Screen cancellation occupies its ordinary ordered frame position, so dropped transfers cannot leave sequence gaps. Terminal close releases all queued bytes and the native writer.

Constructors

Link copied to clipboard
constructor(address: RemoteAddress, limits: RemoteLimits = RemotePacket.limits, send: (ByteArray) -> Unit)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
fun drain(nowMillis: Long, maxFrames: Int = 64, receive: (ByteArray) -> Unit)

Delivers at most maxFrames consecutive fragments and checks deadlines even without new network input.

Link copied to clipboard
fun limitTo(negotiated: RemoteLimits)

Tightens admission after negotiation, rejecting already queued work that exceeds the negotiated bounds.

Link copied to clipboard
fun offer(packet: RemotePacket.Frame, nowMillis: Long)

Copies a current-incarnation fragment into the bounded reorder queue; stale incarnations and duplicates are ignored. Conflicting duplicate content, impossible identities, and queue exhaustion fail explicitly.

Link copied to clipboard
fun send(bytes: ByteArray)

Adds a strictly increasing envelope sequence immediately before native delivery. Bootstrap greetings retain the fixed native bound even when peer negotiation has already tightened incoming admission.