Skip to content

Commit

Permalink
some updates
Browse files Browse the repository at this point in the history
  • Loading branch information
BrennanConroy committed Apr 10, 2024
1 parent cebb459 commit b076b7d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Servers/Kestrel/Core/src/Internal/Http2/Http2FrameWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ public void UpdateMaxFrameSize(uint maxFrameSize)
}

/// <summary>
/// Call while in the <c>_writeLock</c>.
/// Call while in the <see cref="_writeLock"/>.
/// </summary>
/// <returns><c>true</c> if already completed.</returns>
private bool CompleteUnsynchronized()
Expand All @@ -397,8 +397,8 @@ public void Complete()
}
}

// Ok to call after aborting the Pipe because we've already set _completed to true which means any writes from the abort call
// won't call into the Pipe.
// Call outside of _writeLock as this can call Http2OutputProducer.Stop which can acquire Http2OutputProducer._dataWriterLock
// which is not the desired lock order
AbortConnectionFlowControl();
}

Expand Down Expand Up @@ -426,6 +426,10 @@ public void Abort(ConnectionAbortedException error)
return;
}
}

// Call outside of _writeLock as this can call Http2OutputProducer.Stop which can acquire Http2OutputProducer._dataWriterLock
// which is not the desired lock order
AbortConnectionFlowControl();
}

private ValueTask<FlushResult> FlushEndOfStreamHeadersAsync(Http2Stream stream)
Expand Down Expand Up @@ -946,7 +950,9 @@ private void ConsumeConnectionWindow(long bytes)
}

/// <summary>
/// Do not call this method under the _writeLock
/// Do not call this method under the _writeLock.
/// This method can call Http2OutputProducer.Stop which can acquire Http2OutputProducer._dataWriterLock
/// which is not the desired lock order
/// </summary>
private void AbortConnectionFlowControl()
{
Expand Down

0 comments on commit b076b7d

Please sign in to comment.