System.Net.WebSockets.WebSocketBase.CleanUp C# (CSharp) Method

CleanUp() private method

private CleanUp ( ) : void
return void
        private void CleanUp()
        {
            // Multithreading: This method is always called under the _ThisLock lock
            if (_cleanedUp)
            {
                return;
            }

            _cleanedUp = true;

            if (SessionHandle != null)
            {
                SessionHandle.Dispose();
            }

            if (_internalBuffer != null)
            {
                _internalBuffer.Dispose(this.State);
            }

            if (_receiveOutstandingOperationHelper != null)
            {
                _receiveOutstandingOperationHelper.Dispose();
            }

            if (_sendOutstandingOperationHelper != null)
            {
                _sendOutstandingOperationHelper.Dispose();
            }

            if (_closeOutputOutstandingOperationHelper != null)
            {
                _closeOutputOutstandingOperationHelper.Dispose();
            }

            if (_closeOutstandingOperationHelper != null)
            {
                _closeOutstandingOperationHelper.Dispose();
            }

            if (_innerStream != null)
            {
                try
                {
                    _innerStream.Close();
                }
                catch (ObjectDisposedException)
                {
                }
                catch (IOException)
                {
                }
                catch (SocketException)
                {
                }
                catch (HttpListenerException)
                {
                }
            }

            _keepAliveTracker.Dispose();
        }