summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2010-07-14 12:36:12 +0200
committerXavier Claessens <xclaesse@gmail.com>2010-07-14 12:36:12 +0200
commit3c762e9c8b2b3bd85ddde2452ac08759438dc449 (patch)
tree6063ae8fa9dc325195084a5c63a5fe275b565d2b
parent598cda677b2d3e956690ad9f03b82584d9797ea5 (diff)
Handle error when Tube channel gets invalidated
-rw-r--r--src/client.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/client.c b/src/client.c
index 6d22934..9edbde8 100644
--- a/src/client.c
+++ b/src/client.c
@@ -153,13 +153,24 @@ offer_tube_cb (TpChannel *channel,
gpointer user_data,
GObject *weak_object)
{
- /* FIXME: If the offer failed, do we have to cancel the pending
- * g_socket_listener_accept_async() ? */
if (error != NULL)
throw_error (error);
}
static void
+channel_invalidated_cb (TpProxy *proxy,
+ guint domain,
+ gint code,
+ gchar *message,
+ gpointer user_data)
+{
+ const GError *error;
+
+ error = tp_proxy_get_invalidated (proxy);
+ throw_error (error);
+}
+
+static void
handle_channel (TpChannel *channel)
{
gchar *dir;
@@ -170,11 +181,17 @@ handle_channel (TpChannel *channel)
GHashTable *parameters;
GError *error = NULL;
+ g_signal_connect (channel, "invalidated",
+ G_CALLBACK (channel_invalidated_cb), NULL);
+
/* We are client side, but we have to offer a socket... So we offer an unix
* socket on which the service side can connect. We also create an IPv4 socket
* on which the ssh client can connect. When both sockets are connected,
* we can forward all communications between them. */
+ /* FIXME: I don't think we close socket connections, or cancel
+ * g_socket_listener_accept_async in all error cases... */
+
listener = g_socket_listener_new ();
/* Create temporary file for our unix socket */