| | 1 | | // Copyright (c) ZeroC, Inc. |
| | 2 | |
|
| | 3 | | using System.Buffers; |
| | 4 | |
|
| | 5 | | namespace IceRpc.Transports; |
| | 6 | |
|
| | 7 | | /// <summary>A property bag used to configure a <see cref="IDuplexConnection" />.</summary> |
| | 8 | | public record class DuplexConnectionOptions |
| | 9 | | { |
| | 10 | | /// <summary>Gets or sets the minimum size of the segment requested from the <see cref="Pool" />.</summary> |
| | 11 | | /// <value>The minimum size in bytes of the segment requested from the <see cref="Pool" />. It cannot be less than |
| | 12 | | /// <c>1</c> KB. Defaults to <c>4</c> KB.</value> |
| | 13 | | public int MinSegmentSize |
| | 14 | | { |
| 2493 | 15 | | get => _minSegmentSize; |
| 1613 | 16 | | set => _minSegmentSize = value >= 1024 ? value : |
| 1613 | 17 | | throw new ArgumentException($"The {nameof(MinSegmentSize)} argument cannot be less than 1KB.", nameof(value) |
| | 18 | | } |
| | 19 | |
|
| | 20 | | /// <summary>Gets or sets the <see cref="MemoryPool{T}" /> object used for buffer management.</summary> |
| | 21 | | /// <value>A pool of memory blocks used for buffer management. Defaults to <see cref="MemoryPool{T}.Shared" |
| | 22 | | /// />.</value> |
| 6761 | 23 | | public MemoryPool<byte> Pool { get; set; } = MemoryPool<byte>.Shared; |
| | 24 | |
|
| 2655 | 25 | | private int _minSegmentSize = 4096; |
| | 26 | | } |