Interface IChannelConnection
The game-facing handle to one QUIC stream's packet flow. Mirrors the Java ChannelConnection
implemented by QuicheChannel: enqueue outbound packets, observe the peer certificate
(for cert-bound auth), and control the connection. All members are safe to call from any thread;
work is marshalled onto the owning connection's event loop.
public interface IChannelConnection
Properties
Channel
The logical channel this stream carries (Default / Chunks / WorldMap / Voice).
NetworkChannel Channel { get; }
Property Value
- NetworkChannel
ClientCertificate
The peer's TLS certificate (mTLS), available once the connection is established.
X509Certificate2? ClientCertificate { get; }
Property Value
SniHostname
The SNI host name the peer requested, if any.
string? SniHostname { get; }
Property Value
Methods
Disconnect(string)
Gracefully close the connection with a human-readable reason.
void Disconnect(string reason)
Parameters
reasonstring
Flush()
Request a flush of any queued packets.
void Flush()
IsHandlerLeaseCurrent(ConnectionHandlerLease, IConnectionHandler)
Determines whether lease still identifies the exact stable generation owned
by expected.
bool IsHandlerLeaseCurrent(ConnectionHandlerLease lease, IConnectionHandler expected)
Parameters
leaseConnectionHandlerLeaseexpectedIConnectionHandler
Returns
TryCaptureHandlerLease(IConnectionHandler, out ConnectionHandlerLease)
Attempts to capture authority for the exact stable generation currently owned by
expected.
bool TryCaptureHandlerLease(IConnectionHandler expected, out ConnectionHandlerLease lease)
Parameters
expectedIConnectionHandlerleaseConnectionHandlerLease
Returns
Remarks
Capture fails while a replacement is in progress, after close, or when the expected handler is no longer current. The returned lease is opaque and valid only for this channel connection.
TryDisconnect(ConnectionHandlerLease, IConnectionHandler, string)
Atomically closes the connection only while lease still identifies the
stable generation owned by expected.
bool TryDisconnect(ConnectionHandlerLease lease, IConnectionHandler expected, string reason)
Parameters
leaseConnectionHandlerLeaseexpectedIConnectionHandlerreasonstring
Returns
- bool
true when this exact handler generation won connection close. Otherwise, false when its authority was stale, foreign, transitioning, or already closed.
TryReplaceHandlerAsync(ConnectionHandlerLease, IConnectionHandler)
Conditionally replaces the exact handler generation identified by expected.
ValueTask<ConnectionHandlerLease?> TryReplaceHandlerAsync(ConnectionHandlerLease expected, IConnectionHandler replacement)
Parameters
expectedConnectionHandlerLeasereplacementIConnectionHandler
Returns
- ValueTask<ConnectionHandlerLease?>
A lease for the installed replacement, or null when the supplied authority is stale, foreign, already consumed, or otherwise not replaceable.
Remarks
Replacement callbacks execute on the owning connection loop. Closing the connection before a stable replacement commits faults the operation with ObjectDisposedException.
Write(IToClientPacket)
Queue a packet to send; flushed by the connection loop.
void Write(IToClientPacket packet)
Parameters
packetIToClientPacket
Write(IEnumerable<IToClientPacket>)
Queues multiple packets for transmission; flushed by the connection loop.
void Write(IEnumerable<IToClientPacket> packets)
Parameters
packetsIEnumerable<IToClientPacket>
WriteAndFlush(IToClientPacket)
Queue a packet and request an immediate flush.
void WriteAndFlush(IToClientPacket packet)
Parameters
packetIToClientPacket
WriteAndFlush(IEnumerable<IToClientPacket>)
Queues multiple packets for transmission and requests an immediate flush.
void WriteAndFlush(IEnumerable<IToClientPacket> packets)
Parameters
packetsIEnumerable<IToClientPacket>