SendAlert() public method

public SendAlert ( Alert alert ) : void
alert Alert
return void
Exemplo n.º 1
0
        private void AsyncHandshakeCallback(IAsyncResult asyncResult)
        {
            var internalResult = asyncResult.AsyncState as InternalAsyncResult;

            try
            {
                try
                {
                    EndNegotiateHandshake(asyncResult);
                }
                catch (Exception ex)
                {
                    protocol.SendAlert(ref ex);
                    throw new IOException("The authentication or decryption has failed.", ex);
                }

                if (internalResult.ProceedAfterHandshake)
                {
                    //kick off the read or write process (whichever called us) after the handshake is complete
                    if (internalResult.FromWrite)
                    {
                        InternalBeginWrite(internalResult);
                    }
                    else
                    {
                        InternalBeginRead(internalResult);
                    }
                    negotiationComplete.Set();
                }
                else
                {
                    negotiationComplete.Set();
                    internalResult.SetComplete();
                }
            }
            catch (Exception ex)
            {
                negotiationComplete.Set();
                internalResult.SetComplete(ex);
            }
        }
Exemplo n.º 2
0
        private void AsyncHandshakeCallback(IAsyncResult asyncResult)
        {
            InternalAsyncResult internalAsyncResult = asyncResult.AsyncState as InternalAsyncResult;

            try
            {
                try
                {
                    OnNegotiateHandshakeCallback(asyncResult);
                }
                catch (TlsException ex)
                {
                    protocol.SendAlert(ex.Alert);
                    throw new IOException("The authentication or decryption has failed.", ex);
                    IL_0036 :;
                }
                catch (Exception innerException)
                {
                    protocol.SendAlert(AlertDescription.InternalError);
                    throw new IOException("The authentication or decryption has failed.", innerException);
                    IL_0055 :;
                }
                if (internalAsyncResult.ProceedAfterHandshake)
                {
                    if (internalAsyncResult.FromWrite)
                    {
                        InternalBeginWrite(internalAsyncResult);
                    }
                    else
                    {
                        InternalBeginRead(internalAsyncResult);
                    }
                    negotiationComplete.Set();
                }
                else
                {
                    negotiationComplete.Set();
                    internalAsyncResult.SetComplete();
                }
            }
            catch (Exception complete)
            {
                negotiationComplete.Set();
                internalAsyncResult.SetComplete(complete);
            }
        }