Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Canceled requests can end up hanging a thread due to the
std::conditional_variable
never being triggered. This is because the previous assumption, that disconnect would be called once there was an http context set in the native layer, was wrong. BecauseNotifyDisconnect
is called by IIS andSetManagedHttpContext
is called by managed code, they can race and end up withm_disconnectFired
as true, butm_pManagedHttpContext
as false.The fix is fairly simple, just don't gate unblocking the
std::conditional_variable
on whether the http context has been set.Added comments as well to make it a little easier to understand some of the code, hopefully we'll slowly improve the maintainability by doing this with future changes as well.