UtpStream

constructor(socket: UdpSocket, remoteHost: String, remotePort: Int, scope: CoroutineScope, nowMicros: () -> Long = MicrosCounter(), connectionId: Int = ((nowMicros() and 0xFFFF).toInt()), minTimeoutMicros: Long = DEFAULT_MIN_TIMEOUT_MICROS, selfTick: Boolean = true, tickIntervalMs: Long = DEFAULT_TICK_INTERVAL_MS, nagleEnabled: Boolean = true)

Parameters

socket

the shared UDP socket used to send; the owner drives receive.

remoteHost

remote peer host.

remotePort

remote peer port.

scope

coroutine scope the background ack/feed work runs in.

nowMicros

injected microsecond clock. The core is clockless, so this defaults to a monotonically increasing counter (MicrosCounter). Production may pass a real monotonic clock so timestamp_difference is meaningful to peers.

connectionId

optional fixed send_id (the SYN goes out on send_id - 1); defaults to a value derived from the clock so two streams differ. Injectable for deterministic tests.