Skip to content

Commit 662d200

Browse files
authored
Add an explanatory comment to DuplexPipe (#56863)
1 parent 85c848b commit 662d200

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/Shared/ServerInfrastructure/DuplexPipe.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@
33

44
namespace System.IO.Pipelines;
55

6+
/// <remarks>
7+
/// A <see cref="Pipe"/> is a reader-writer pair, where content written to the writer can be read from the reader.
8+
///
9+
/// An <see cref="IDuplexPipe"/> is *not* a pipe. It is also a reader-writer pair, but the reader and writer are not
10+
/// connected. Rather, it can be regarded as *one end* of a two-way (i.e. duplex) communication channel, where content
11+
/// written to the writer is sent to the counterparty and content received from the counterparty is readable from the
12+
/// reader.
13+
///
14+
/// A <see cref="DuplexPipePair"/> is a pair of <see cref="IDuplexPipe"/> instances, each of which represents one end of
15+
/// a two-way communication channel. (In a sense, this makes it a "duplex pipe".) It can also be viewed as a pair of
16+
/// <see cref="Pipe"/>s, as these underlie the <see cref="IDuplexPipe"/> instances. In either view, it is composed of
17+
/// two <see cref="PipeReader"/>s and two <see cref="PipeWriter"/>s - it is only how they are grouped that differs.
18+
/// </remarks>
619
internal sealed class DuplexPipe : IDuplexPipe
720
{
821
public DuplexPipe(PipeReader reader, PipeWriter writer)

0 commit comments

Comments
 (0)