-
Notifications
You must be signed in to change notification settings - Fork 5.2k
avoid allocationg ApplicationProtocol in common case #69098
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
|
Tagging subscribers to this area: @dotnet/ncl, @vcsjones Issue Detailscontributes to #68951
|
src/libraries/System.Net.Security/src/System/Net/Security/SslConnectionInfo.cs
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Windows/SChannel/Interop.SecPkgContext_ApplicationProtocol.cs
Show resolved
Hide resolved
| alpnContext.ProtoNegoStatus == Interop.ApplicationProtocolNegotiationStatus.Success) | ||
| { | ||
| return alpnContext.Protocol; | ||
| if (alpnContext.ProtocolIdSize == s_http1.Length && alpnContext.Protocol.SequenceEqual(s_http1)) |
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.
Why does the Windows one check ProtocolIdSize but the Linux one doesn't?
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.
The code originally looked different and I did not want to allocate the Span unless we need to. Perhaps that is cheap. Here I have the size available directly so I left the check in place. On Linux, The Interop function returns always Span so the code is somewhat different. I can remove the extra check if we want to.
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.
LGTM, modulo existing comments
contributes to #68951
For now, I updated Linux & Windows. Other platforms may be possible.