-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Make the HTTP.sys accept loop cheaper #28345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Allocate a single AsyncAcceptContext per loop instead of one per request. - The AsyncAcceptContext now implements IValueTaskSource instead of Task and doesn't allocate a Task per request. - Use a preallocated overlapped since we don't have overlapping calls to accept for a single AsyncAcceptContext. - Remove some dead code from SafeNativeOverlapped
if (statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && | ||
statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_IO_PENDING) | ||
{ | ||
// some other bad error, possible(?) return values are: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No disposal is done here since the caller will end up calling AcceptAsync again and that will end up clearing the previously allocated request context (same goes for all other places that used to call dispose).
- Move NativeOverlapped* to the AsyncAcceptContext. This removes the SafeNativeOverlapped allocation as the lifetime is managed by the AsyncAcceptContext - Rename tcs
No, just the diff. I'll take a look at this one soon. |
Hello @davidfowl! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
Task and doesn't allocate a Task per request.
Contributes to #22022