summaryrefslogtreecommitdiff
path: root/src/idle-connection.c
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2012-03-30 13:22:27 +0100
committerWill Thompson <will.thompson@collabora.co.uk>2012-03-30 13:22:27 +0100
commit461c00a7db16b8473d64dacd2af048b8b3b480b3 (patch)
treee7e30f6060218b2ec4b9b6ae4f0fcfd2e51b3a31 /src/idle-connection.c
parent05fa69e93345351ac193008596b5318afddd9bca (diff)
Connection: handle ServerConn errors while Connecting
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=48084
Diffstat (limited to 'src/idle-connection.c')
-rw-r--r--src/idle-connection.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/idle-connection.c b/src/idle-connection.c
index 0be6f2f..ef945cf 100644
--- a/src/idle-connection.c
+++ b/src/idle-connection.c
@@ -597,14 +597,19 @@ static void _iface_shut_down(TpBaseConnection *self) {
}
static void _connection_disconnect_with_gerror(IdleConnection *conn, TpConnectionStatusReason reason, const gchar *key, const GError *error) {
- GHashTable *details = tp_asv_new(key, G_TYPE_STRING, error->message, NULL);
-
- g_assert(error->domain == TP_ERRORS);
- tp_base_connection_disconnect_with_dbus_error(TP_BASE_CONNECTION(conn),
- tp_error_get_dbus_name(error->code),
- details,
- reason);
- g_hash_table_unref(details);
+ if (TP_BASE_CONNECTION (conn)->status == TP_CONNECTION_STATUS_DISCONNECTED) {
+ IDLE_DEBUG ("Already disconnected; refusing to report error %s", error->message);
+ } else {
+ GHashTable *details = tp_asv_new(key, G_TYPE_STRING, error->message, NULL);
+
+ g_assert(error->domain == TP_ERRORS);
+
+ tp_base_connection_disconnect_with_dbus_error(TP_BASE_CONNECTION(conn),
+ tp_error_get_dbus_name(error->code),
+ details,
+ reason);
+ g_hash_table_unref(details);
+ }
}
static void _connection_disconnect_with_error(IdleConnection *conn, TpConnectionStatusReason reason, const gchar *key, GQuark domain, gint code, const gchar *message) {
@@ -762,13 +767,7 @@ static void sconn_status_changed_cb(IdleServerConnection *sconn, IdleServerConne
switch (state) {
case SERVER_CONNECTION_STATE_NOT_CONNECTED:
- /* when the Disconnect method is called, the parent's status is
- * immediately set to disconnected, and when the underlying network
- * connection finally disconnects and triggers this callback
- * we need to finish shutting down the connection -- so we can only
- * ignore the case where the parent's status is connecting */
- if (conn->parent.status != TP_CONNECTION_STATUS_CONNECTING)
- connection_disconnect_cb(conn, tp_reason);
+ connection_disconnect_cb(conn, tp_reason);
break;
case SERVER_CONNECTION_STATE_CONNECTING: