Class QuicStreamConnection
- Namespace
- VpnHood.Core.Tunneling.Connections
- Assembly
- VpnHood.Core.Tunneling.dll
Represents a QUIC stream as a stream connection.
public sealed class QuicStreamConnection : IStreamConnection, IDisposable, IAsyncDisposable
- Inheritance
-
QuicStreamConnection
- Implements
- Inherited Members
Constructors
QuicStreamConnection(Stream, IPEndPoint, IPEndPoint, string, bool, string?)
Initializes a new instance of the QuicStreamConnection class.
public QuicStreamConnection(Stream stream, IPEndPoint localEndPoint, IPEndPoint remoteEndPoint, string connectionName, bool isServer, string? connectionId = null)
Parameters
streamStreamThe QUIC stream, which the connection owns.
localEndPointIPEndPointThe QUIC connection's local endpoint.
remoteEndPointIPEndPointThe QUIC connection's remote endpoint.
connectionNamestringThe connection's name, which its logs carry.
isServerbooltrue for the server's side of the connection.
connectionIdstringThe connection's ID, or null for a new one.
Properties
Connected
Gets a value indicating whether the connection is up.
public bool Connected { get; }
Property Value
Remarks
It is true until the connection's close.
ConnectionId
Gets or sets the connection's ID, which its logs carry.
public string ConnectionId { get; set; }
Property Value
ConnectionName
Gets the connection's name, which its logs carry.
public string ConnectionName { get; }
Property Value
IsServer
Gets a value indicating whether this is the server's side of the connection, which its logs show.
public bool IsServer { get; }
Property Value
LocalEndPoint
Gets the connection's local endpoint.
public IPEndPoint LocalEndPoint { get; }
Property Value
RemoteEndPoint
Gets the peer's endpoint.
public IPEndPoint RemoteEndPoint { get; }
Property Value
RequireHttpResponse
Gets or sets a value indicating whether an HTTP response to the connection's request header is still due before the request's own answer: the server writes it, and the client reads it.
public bool RequireHttpResponse { get; set; }
Property Value
Stream
Gets the stream the connection carries.
public Stream Stream { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Remarks
It starts DisposeAsync() and does not wait for it: a QUIC stream's synchronous close waits for its peer, on a dead network until its connection gives up.
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public ValueTask DisposeAsync()
Returns
- ValueTask
A task that represents the asynchronous dispose operation.
Remarks
It closes the stream, then raises Disposed; a second call waits for the first one's end.
PreventReuse()
Makes the connection's release close it rather than keep it for another request.
public void PreventReuse()
Remarks
A decorator passes it on, so it reaches the reusable connection however that is wrapped.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Remarks
It is the ID, the name, the side and the transport: id:name:server:quic or id:name:client:quic.
Events
Disposed
Occurs once the connection has closed, its stream's close failed or not, as its QUIC connection counts its streams down on it.
public event EventHandler? Disposed