httpcore icon indicating copy to clipboard operation
httpcore copied to clipboard

Remove shielding from cancellation process.

Open tomchristie opened this issue 8 months ago • 1 comments

For handling async-cancellations we're currently shielding close operations, in order to ensure we don't end up with a connection in an inconsistent state when cancellations are used.

A better approach is to ensure that the state changes for this case are handled synchronously (so that cancellations won't propagate into those). While the network close remains unshielded async (it's okay for cancellations to propagate into those).

Reasoning about the state when cancellations occur is a bit fiddly, tho I think we can apply this same style of approach all the way through to remove the need for async cancellation-shielding. (Closing state is applied first synchronously. Network close operations are then attempted, and may propagate cancellation.)

Refs #922

tomchristie avatar Jun 13 '24 16:06 tomchristie