Don't call getsockname on every packet#11850
Conversation
|
@maskit What's the reason for changing the socket storage type from |
|
Because it seemed more appropriate type, although sockkaddr_in6 is technically large enough for our use case. |
JosiahWI
left a comment
There was a problem hiding this comment.
Thanks. It's nice not to waste resources calling getsockname when the DNSConnection already has a local copy. It looks like that local copy should always exist since it's created in UDPBind.
I'm sad to see the introduction of reinterpret_casts, but it seems sockaddr_storage is designed for this kind of purpose, and the casts are guaranteed by POSIX in most cases not to violate strict aliasing, which is a nice bonus even though we don't enforce strict aliasing requirements.
This may not be true on outgoing QUIC connections, although we currently don't support it. |
|
I think it's set on the QUIC connections as well. |
|
Cherry-picked to v10.0.x |
* Don't call getsockname on every packet * fix errors * fix errors * fix errors * fix errors * fix wording (cherry picked from commit a8932cf)
* Don't call getsockname on every packet * fix errors * fix errors * fix errors * fix errors * fix wording (cherry picked from commit a8932cf)
UnixUDPConnectionshould have a local copy of the local address so no need to bother Kernel.