-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Use shared SocketAddress code in QUIC #66794
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 Issue DetailsThis PR replaces duplicated code for composing OS-level SOCKADDR_INET structure by preexisting code in SocketAddress class. Fixes #32068
|
|
Tagging subscribers to this area: @dotnet/ncl Issue DetailsThis PR replaces duplicated code for composing OS-level SOCKADDR_INET structure by preexisting code in SocketAddress class. Fixes #32068
|
ManickaP
left a comment
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.
I gave a cursory look at the internal SocketAddress and I think we should invest in some optimization there and here together.
I might be looking wrongly, but it looks like this will introduce more copies of address bytes as well as more interop calls per each conversion (not necessarily meaning more allocations, though).
| internal uint ListenerStart(SafeMsQuicListenerHandle listener, QuicBuffer* alpnBuffers, uint alpnBufferCount, byte* localAddress) | ||
| { | ||
| IntPtr __listener_gen_native = default; | ||
| IntPtr __listener_gen_native; |
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 this line change?
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.
Compiler complained that the default-assigned value was never used
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.
We still have it like that in other places since this is source generated code, so could we leave it as it was? Unless it breaks the build due to warnaserror or something like that.
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.
it breaks the build otherwise
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.
Let's keep it then. It's still strange that the other methods or the previous version of this one didn't break the build.
...ystem.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Internal/MsQuicParameterHelpers.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicListener.cs
Outdated
Show resolved
Hide resolved
| value.Buffer.AsSpan(0, value.Size).CopyTo(address); | ||
| address.Slice(value.Size).Clear(); | ||
|
|
||
| fixed (byte* paddress = &MemoryMarshal.GetReference(address)) |
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.
Do we need pinning if the the source is stack allocated? I don't know the answer here, just asking. Or what does fixed here exactly do?
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.
It doesn't really do anything here, but the language requires you to use a fixed statement when "taking the address of an unfixed expression" like this.
Alternatively, it could be written as this (not saying it should be):
byte* pAddress = stackalloc byte[Internals.SocketAddress.IPv6AddressSize];
var address = new Span<byte>(pAddress, Internals.SocketAddress.IPv6AddressSize);
wfurt
left a comment
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.
I'm wondering if this actually works with current quic e.g. 1.9. QUIC_ADDRESS_FAMILY.INET6 is same for all platforms but the new code will actually use the platform value AFAIK.
I thought that 1.9 is the one currently running as part of our CI, is it not, @ManickaP? I manually downloaded 1.9 for local testing purposes and it worked on windows. |
Nice catch, I'm wondering whether this means that we don't have any coverage for IPv6 and we should probably add it. |
But we should be fine once we upgrade MsQuic, right? since latest MsQuic moved to platform-specific values again. |
yes |
|
So to push this to a conclusion. Can we add tests for this:
If this change is expected to break for IPv6 and didn't actually blow anything up: Then, an issue for this needs to be filed, against which the new test will be disabled. And finally, we'll resolve the issue with msquic 2.0 update (I already have some WIP so it shouldn't take much longer). Does it sound reasonable @rzikm ? |
ManickaP
left a comment
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.
Thanks!
This PR replaces duplicated code for composing OS-level SOCKADDR_INET structure by preexisting code in SocketAddress class.
Fixes #32068