internal void SetUnmanagedStructures(object objectsToPin)
{
Socket s = (Socket)AsyncObject;
// Bind the Win32 Socket Handle to the ThreadPool
Debug.Assert(s != null, "m_CurrentSocket is null");
Debug.Assert(s.SafeHandle != null, "m_CurrentSocket.SafeHandle is null");
if (s.SafeHandle.IsInvalid)
{
throw new ObjectDisposedException(s.GetType().FullName);
}
ThreadPoolBoundHandle boundHandle = s.SafeHandle.GetOrAllocateThreadPoolBoundHandle();
unsafe
{
NativeOverlapped* overlapped = boundHandle.AllocateNativeOverlapped(s_ioCallback, this, objectsToPin);
_nativeOverlapped = new SafeNativeOverlapped(s.SafeHandle, overlapped);
if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"{boundHandle}::AllocateNativeOverlapped. return={_nativeOverlapped}");
}
}