System.Net.HttpListener.DisconnectAsyncResult.HandleDisconnect C# (CSharp) Method

HandleDisconnect() private method

private HandleDisconnect ( ) : void
return void
            private void HandleDisconnect()
            {
                if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"DisconnectResults {_httpListener.DisconnectResults} removing for _connectionId: {_connectionId}");
                _httpListener.DisconnectResults.Remove(_connectionId);
                if (_session != null)
                {
                    throw new NotImplementedException();
                }

                // Clean up the identity. This is for scenarios where identity was not cleaned up before due to
                // identity caching for unsafe ntlm authentication

                IDisposable identity = _authenticatedConnection == null ? null : _authenticatedConnection.Identity as IDisposable;
                if ((identity != null) &&
                    (_authenticatedConnection.Identity.AuthenticationType == AuthConstants.NTLM) &&
                    (_httpListener.UnsafeConnectionNtlmAuthentication))
                {
                    identity.Dispose();
                }

                int oldValue = Interlocked.Exchange(ref _ownershipState, 3);
                Debug.Assert(oldValue == 2, $"Expected OwnershipState of 2, saw {oldValue}.");
            }