apple / swift-nio-http2

HTTP/2 support for SwiftNIO
https://swiftpackageindex.com/apple/swift-nio-http2/main/documentation/niohttp2
Apache License 2.0
462 stars 82 forks source link

Remove precondition: yielding to terminated AsyncSequence #432

Closed rnro closed 9 months ago

rnro commented 9 months ago

Motivation:

If a task iterating over inbound streams using the new async API is cancelled then it can lead to the process crashing as we hit a precondition which guards against yielding to a terminated NIOHTTP2AsyncSequence.

Modifications:

Remove the precondition.

Result:

The code no longer crashes, instead it silently drops the yielded value.

Doing more than this such as closing the connection requires rethinking more of the API.