Table of Contents

Class MultiplexingStream.Options

Namespace
Nerdbank.Streams
Assembly
Nerdbank.Streams.dll

Describes the options that a MultiplexingStream may be created with.

public class MultiplexingStream.Options
Inheritance
MultiplexingStream.Options
Inherited Members

Constructors

Options()

Initializes a new instance of the MultiplexingStream.Options class.

public Options()

Options(Options)

Initializes a new instance of the MultiplexingStream.Options class and copies the values from another instance into this one.

public Options(MultiplexingStream.Options copyFrom)

Parameters

copyFrom MultiplexingStream.Options

The instance to copy values from.

Properties

DefaultChannelReceivingWindowSize

Gets or sets the number of received bytes that may be buffered locally per channel (transmitted from the remote party but not yet processed).

public long DefaultChannelReceivingWindowSize { get; set; }

Property Value

long

Must be a positive value.

Remarks

This value is ignored when ProtocolMajorVersion is set to 1.

Exceptions

ArgumentOutOfRangeException

Thrown if set to a non-positive value.

DefaultChannelTraceSourceFactory

Gets or sets a factory for TraceSource instances to attach to a newly opened MultiplexingStream.Channel when its TraceSource is null.

[Obsolete("Use DefaultChannelTraceSourceFactoryWithQualifier instead.")]
public Func<int, string, TraceSource?>? DefaultChannelTraceSourceFactory { get; set; }

Property Value

Func<int, string, TraceSource>

Remarks

The delegate receives a channel ID and name, and may return a TraceSource or null.

This delegate will not be invoked if DefaultChannelTraceSourceFactoryWithQualifier has been set to a non-null value.

DefaultChannelTraceSourceFactoryWithQualifier

Gets or sets a factory for TraceSource instances to attach to a newly opened MultiplexingStream.Channel when its TraceSource is null.

public Func<MultiplexingStream.QualifiedChannelId, string, TraceSource?>? DefaultChannelTraceSourceFactoryWithQualifier { get; set; }

Property Value

Func<MultiplexingStream.QualifiedChannelId, string, TraceSource>

Remarks

The delegate receives a channel ID and name, and may return a TraceSource or null.

This delegate supersedes the obsolete DefaultChannelTraceSourceFactory as this one provides detail about whether the channel was offered locally or remotely.

FaultOpenChannelsOnStreamDisposal

Gets or sets a value indicating whether any open channels should be faulted (i.e. their Completion task will be faulted) when the MultiplexingStream is disposed.

public bool FaultOpenChannelsOnStreamDisposal { get; set; }

Property Value

bool

IsFrozen

Gets a value indicating whether this instance is frozen.

public bool IsFrozen { get; }

Property Value

bool

ProtocolMajorVersion

Gets or sets the protocol version to be used.

public int ProtocolMajorVersion { get; set; }

Property Value

int

The default is 1.

Remarks

1 is the original and default version. 2 is a protocol breaking change and adds backpressure support. 3 is a protocol breaking change that removes the initial handshake so no round-trip to establish the connection is necessary.

SeededChannels

Gets a list of options for channels that are to be "seeded" into a new MultiplexingStream.

public IList<MultiplexingStream.ChannelOptions> SeededChannels { get; }

Property Value

IList<MultiplexingStream.ChannelOptions>

Remarks

Seeded channels avoid the need for a round-trip for an offer/accept packet exchange. Seeded channels are accessed within the MultiplexingStream instance by calling AcceptChannel(ulong, ChannelOptions?) with the 0-based index into this list used as the channel ID. They are only supported when ProtocolMajorVersion is at least 3.

StartSuspended

Gets or sets a value indicating whether the MultiplexingStream should not start reading from the stream immediately in order to provide time for the creator to add event handlers such as ChannelOffered.

public bool StartSuspended { get; set; }

Property Value

bool

The default value is false.

Remarks

When set to true, the owner must use StartListening() after attaching event handlers to actually being reading from the stream.

TraceSource

Gets or sets the logger used by this instance.

public TraceSource TraceSource { get; set; }

Property Value

TraceSource

Never null.

Methods

GetFrozenCopy()

Returns a frozen instance of this object.

public MultiplexingStream.Options GetFrozenCopy()

Returns

MultiplexingStream.Options

This instance if already frozen, otherwise a frozen copy.