Beispiel #1
0
        private void ProcessSendFatalAlert(Alert alert)
        {
            try {
                // Create and encrypt the alert record
                Record record = new Record(RecordType.Alert, _handshakeSession.NegotiatedVersion, alert.GetBytes());
                _recordHandler.ProcessOutputRecord(record);

                // Attempt sending the alert record
                _recordStream.Send(new Record[] { record });
                _recordStream.Flush();
                _recordStream.Close();
            } catch (Exception) {}
        }
Beispiel #2
0
 private void ProcessAlertRecord(Record record, AsyncGenericResult asyncGenericResult)
 {
     // TODO: Received an alert, handle correctly
     Alert alert = new Alert(record.Fragment);
     Console.WriteLine("Received an alert: " + alert.Description);
     if (alert.Level == AlertLevel.Fatal) {
         // Fatal alerts don't need close notify
         _recordStream.Close();
         asyncGenericResult.SetComplete(new Exception("Received a fatal alert"));
         return;
     }
 }