System.Net.WebSockets.WebSocketHttpListenerDuplexStream.HttpListenerAsyncEventArgs.FreeOverlapped C# (CSharp) Method

FreeOverlapped() private method

private FreeOverlapped ( bool checkForShutdown ) : void
checkForShutdown bool
return void
            private unsafe void FreeOverlapped(bool checkForShutdown)
            {
                if (!checkForShutdown || !Environment.HasShutdownStarted)
                {
                    // Free the overlapped object
                    if (_ptrNativeOverlapped != null)
                    {
                        _boundHandle.FreeNativeOverlapped(_ptrNativeOverlapped);
                        _ptrNativeOverlapped = null;
                    }

                    if (_dataChunksGCHandle.IsAllocated)
                    {
                        _dataChunksGCHandle.Free();
                        _dataChunks = null;
                    }
                }
            }