Remove a couple allocations from Socket.Connect/Bind/etc. (#32271)
authorStephen Toub <stoub@microsoft.com>
Fri, 14 Feb 2020 16:09:44 +0000 (08:09 -0800)
committerGitHub <noreply@github.com>
Fri, 14 Feb 2020 16:09:44 +0000 (08:09 -0800)
commit8f546c925918741f604a58b945545bad4355aba6
treecb5498a2a387c213fa1101a27dd8fde6b290e6c1
parent0d08b0232dc98c1ec6e623223ea36c894bfd7d6f
Remove a couple allocations from Socket.Connect/Bind/etc. (#32271)

The Socket implementation calls the internal SnapshotAndSerialize method on a bunch of code paths, like Connect, Bind, etc.  The "snapshot" part of the name comes from the time of CAS, and the implementation needed to clone the instance to make security decisions.  We no longer make such decisions, but we're still cloning the objects.  We can stop doing that.
src/libraries/Common/src/System/Net/Internals/IPEndPointExtensions.cs
src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs