[PATCH] Don't close the socket before the coroutine shut down.



Hi Daniel,
Here's another issue related to TLS:

The connection shutdown needs the socket intact:

7  0xb6d38cdf in vnc_connection_tls_push (transport=0x8d84108, data=0x8df33c0, len=229) at vncconnection.c:942
8  0xb6b30437 in ?? () from /usr/lib/libgnutls.so.26
9  0xb6b2d12c in _gnutls_send_int () from /usr/lib/libgnutls.so.26
10 0xb6b4d682 in gnutls_alert_send () from /usr/lib/libgnutls.so.26
11 0xb6b2d662 in gnutls_bye () from /usr/lib/libgnutls.so.26
12 0xb6d3a620 in vnc_connection_close (conn=0x8d84108) at vncconnection.c:4323

so close the socket after the coroutine shutdown. Otherwise it fills the
console with:

(gvncviewer:11056): GLib-GIO-CRITICAL **: g_socket_send: assertion `G_IS_SOCKET (socket) && buffer != NULL' failed

and gets stuck in an endless loop. Patch attached.
Cheers,
 -- Guido
>From dbccd9ebd923976ee3df712fab8f9f627eed230e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx sigxcpu org>
Date: Fri, 17 Sep 2010 18:04:31 +0200
Subject: [PATCH] Don't close the socket before the coroutine shut down.

The connection shutdown needs the socket intact:

7  0xb6d38cdf in vnc_connection_tls_push (transport=0x8d84108, data=0x8df33c0, len=229) at vncconnection.c:942
8  0xb6b30437 in ?? () from /usr/lib/libgnutls.so.26
9  0xb6b2d12c in _gnutls_send_int () from /usr/lib/libgnutls.so.26
10 0xb6b4d682 in gnutls_alert_send () from /usr/lib/libgnutls.so.26
11 0xb6b2d662 in gnutls_bye () from /usr/lib/libgnutls.so.26
12 0xb6d3a620 in vnc_connection_close (conn=0x8d84108) at vncconnection.c:4323

so close the socket after the coroutine shutdown. Otherwise it fills the
console with:

(gvncviewer:11056): GLib-GIO-CRITICAL **: g_socket_send: assertion `G_IS_SOCKET (socket) && buffer != NULL' failed

and gets stuck in an endless loop.
---
 src/vncconnection.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/vncconnection.c b/src/vncconnection.c
index 9ad472a..567c6b8 100644
--- a/src/vncconnection.c
+++ b/src/vncconnection.c
@@ -4402,16 +4403,16 @@ void vnc_connection_shutdown(VncConnection *conn)
 		priv->open_id = 0;
 	}
 
+	priv->fd = -1;
+	priv->has_error = 1;
+	VNC_DEBUG("Waking up couroutine to shutdown gracefully");
+	g_io_wakeup(&priv->wait);
+
 	if (priv->sock) {
 		g_socket_close(priv->sock, NULL);
 		g_object_unref(priv->sock);
 		priv->sock = NULL;
 	}
-
-	priv->fd = -1;
-	priv->has_error = 1;
-	VNC_DEBUG("Waking up couroutine to shutdown gracefully");
-	g_io_wakeup(&priv->wait);
 }
 
 gboolean vnc_connection_is_open(VncConnection *conn)
-- 
1.7.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]