[Bugfix] Call gnutls_bye only when handshake is completed.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4275 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/rfb/CSecurityTLS.cxx b/common/rfb/CSecurityTLS.cxx
index ed570ad..c22fa2d 100644
--- a/common/rfb/CSecurityTLS.cxx
+++ b/common/rfb/CSecurityTLS.cxx
@@ -116,11 +116,11 @@
x509crl.setDefaultStr(strdup(crlDefault.buf));
}
-void CSecurityTLS::shutdown()
+void CSecurityTLS::shutdown(bool needbye)
{
- if (session)
+ if (session && needbye)
if (gnutls_bye(session, GNUTLS_SHUT_RDWR) != GNUTLS_E_SUCCESS)
- throw Exception("gnutls_bye failed");
+ vlog.error("gnutls_bye failed");
if (anon_cred) {
gnutls_anon_free_client_credentials(anon_cred);
@@ -143,7 +143,7 @@
CSecurityTLS::~CSecurityTLS()
{
- shutdown();
+ shutdown(true);
if (fis)
delete fis;
@@ -191,7 +191,7 @@
if (err != GNUTLS_E_SUCCESS) {
vlog.error("TLS Handshake failed: %s\n", gnutls_strerror (err));
- shutdown();
+ shutdown(false);
throw AuthFailureException("TLS Handshake failed");
}