Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add read state transitions info
  • Loading branch information
CarnaViire committed Jul 12, 2021
commit b01d6a44e0e64e28f7b9d7fb045fc79800d3fa1c
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,16 @@ private static uint HandleEventConnectionClose(State state)
private static Exception GetConnectionAbortedException(State state) =>
ThrowHelper.GetConnectionAbortedException(state.ConnectionState.AbortErrorCode);

// Read state transitions:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome comment! 🥳

//
// None --(data arrives in event RECV)-> IndividualReadComplete --(user calls ReadAsync() & completes syncronously)-> None
// None --(user calls ReadAsync() & waits)-> PendingRead --(data arrives in event RECV & completes user's ReadAsync())-> None
// Any non-final state --(event PEER_SEND_SHUTDOWN or SHUTDOWN_COMPLETED with ConnectionClosed=false)-> ReadsCompleted
// Any non-final state --(event PEER_SEND_ABORT)-> Aborted
// Any non-final state --(user calls AbortRead())-> Aborted
// Any state --(CancellationToken's cancellation for ReadAsync())-> Aborted (TODO: should it be only for non-final as others?)
// Any non-final state --(event SHUTDOWN_COMPLETED with ConnectionClosed=true)-> ConnectionClosed
// Closed - no transitions, set for Unidirectional write-only streams
private enum ReadState
{
/// <summary>
Expand All @@ -1428,6 +1438,8 @@ private enum ReadState
/// </summary>
PendingRead,

// following states are final:

/// <summary>
/// The peer has gracefully shutdown their sends / our receives; the stream's reads are complete.
/// </summary>
Expand Down