summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crypto/src/tls/TlsProtocol.cs14
1 files changed, 7 insertions, 7 deletions
diff --git a/crypto/src/tls/TlsProtocol.cs b/crypto/src/tls/TlsProtocol.cs
index db30f6b40..317b6b193 100644
--- a/crypto/src/tls/TlsProtocol.cs
+++ b/crypto/src/tls/TlsProtocol.cs
@@ -259,18 +259,18 @@ namespace Org.BouncyCastle.Tls
             {
                 this.m_closed = true;
 
-                if (user_canceled && !m_appDataReady)
-                {
-                    RaiseAlertWarning(AlertDescription.user_canceled, "User canceled handshake");
-                }
-
-                RaiseAlertWarning(AlertDescription.close_notify, "Connection closed");
-
                 if (!m_appDataReady)
                 {
                     CleanupHandshake();
+
+                    if (user_canceled)
+                    {
+                        RaiseAlertWarning(AlertDescription.user_canceled, "User canceled handshake");
+                    }
                 }
 
+                RaiseAlertWarning(AlertDescription.close_notify, "Connection closed");
+
                 CloseConnection();
             }
         }