Table of Contents

Class StatusAddressFamilyHandler

Namespace
VpnHood.Core.Server.Access.Managers.HttpAccessManagers
Assembly
VpnHood.Core.Server.Access.dll

Represents the HTTP handler that sends a server's status calls over the given IP versions in turn, each on a new connection: the access manager sees the address a call comes from, so it learns when one of the server's addresses changes.

public sealed class StatusAddressFamilyHandler : HttpMessageHandler, IDisposable
Inheritance
StatusAddressFamilyHandler
Implements
Inherited Members

Remarks

An IP version that does not connect within 5 seconds gives way to the other inside the connect, before anything is sent: a status carries usage, and must never go twice. Every other call goes over a pooled connection, as usual.

Constructors

StatusAddressFamilyHandler(IReadOnlyList<AddressFamily>)

Initializes a new instance of the StatusAddressFamilyHandler class.

public StatusAddressFamilyHandler(IReadOnlyList<AddressFamily> addressFamilies)

Parameters

addressFamilies IReadOnlyList<AddressFamily>

The IP versions to take in turn: IPv4 alone sends every status over IPv4, and over IPv6 only where IPv4 does not connect.

Exceptions

ArgumentException

addressFamilies is empty, or names other than IPv4 and IPv6.

Methods

Dispose(bool)

Releases the unmanaged resources used by the HttpMessageHandler and optionally disposes of the managed resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to releases only unmanaged resources.

SendAsync(HttpRequestMessage, CancellationToken)

Send an HTTP request as an asynchronous operation.

protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)

Parameters

request HttpRequestMessage

The HTTP request message to send.

cancellationToken CancellationToken

The cancellation token to cancel operation.

Returns

Task<HttpResponseMessage>

The task object representing the asynchronous operation.

Remarks

A status goes over the next IP version on a new connection; any other call over a pooled one.

Exceptions

ArgumentNullException

The request was null.

OperationCanceledException

The cancellation token was canceled. This exception is stored into the returned task.