Class StreamConnectionDecorator
- Namespace
- VpnHood.Core.Tunneling.Connections
- Assembly
- VpnHood.Core.Tunneling.dll
Represents a connection over another, which passes everything on to it, and may read and write through a stream of its own over the other's, as a buffer.
public class StreamConnectionDecorator : IStreamConnection, IDisposable, IAsyncDisposable
- Inheritance
-
StreamConnectionDecorator
- Implements
- Inherited Members
Constructors
StreamConnectionDecorator(IStreamConnection, Stream?)
Represents a connection over another, which passes everything on to it, and may read and write through a stream of its own over the other's, as a buffer.
public StreamConnectionDecorator(IStreamConnection streamConnection, Stream? stream = null)
Parameters
streamConnectionIStreamConnectionThe connection it wraps.
streamStreamThe stream to read and write through, which it owns, or null for the wrapped connection's.
Properties
Connected
Gets a value indicating whether the connection is up.
public virtual bool Connected { get; }
Property Value
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
Remarks
It is the given stream where there is one, otherwise the wrapped connection's.
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public virtual void Dispose()
Remarks
It closes its own stream, if it has one, then the wrapped connection, at once; a failure of its stream's close leaves the wrapped connection as it is.
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public virtual ValueTask DisposeAsync()
Returns
- ValueTask
A task that represents the asynchronous dispose operation.
Remarks
It closes its own stream, if it has one, then releases the wrapped connection, which a failure of its stream's close skips; 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 virtual void PreventReuse()
Remarks
A decorator passes it on, so it reaches the reusable connection however that is wrapped.