diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2011-03-23 14:22:47 +0000 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2011-03-23 14:22:47 +0000 |
commit | cb93301773ea352620240635fef0dfaaf2dd03ae (patch) | |
tree | 4e3b5e078e48e0d7841b7d7d93433457796322a5 | |
parent | e093db2728f7b9bcea85b7b3d1ec1af9cb3601f5 (diff) |
connection: use new wocky_porter_close_async behaviourclose
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r-- | src/connection.c | 54 |
1 files changed, 4 insertions, 50 deletions
diff --git a/src/connection.c b/src/connection.c index 9fb283923..7819880c5 100644 --- a/src/connection.c +++ b/src/connection.c @@ -262,9 +262,6 @@ struct _GabbleConnectionPrivate /* stream id returned by the connector */ gchar *stream_id; - /* timer used when trying to properly disconnect */ - guint disconnect_timer; - /* Number of things we are waiting for before changing the connection status * to connected */ guint waiting_connected; @@ -1163,12 +1160,6 @@ gabble_connection_dispose (GObject *object) gabble_capability_set_free (priv->sidecar_caps); gabble_capability_set_free (priv->bonus_caps); - if (priv->disconnect_timer != 0) - { - g_source_remove (priv->disconnect_timer); - priv->disconnect_timer = 0; - } - tp_clear_object (&self->pep_location); tp_clear_object (&self->pep_nick); tp_clear_object (&self->pep_olpc_buddy_props); @@ -1524,7 +1515,7 @@ force_close_cb (GObject *source, TpBaseConnection *base = TP_BASE_CONNECTION (self); GError *error = NULL; - if (!wocky_porter_force_close_finish (WOCKY_PORTER (source), res, &error)) + if (!wocky_porter_close_finish (WOCKY_PORTER (source), res, &error)) { DEBUG ("force close failed: %s", error->message); g_error_free (error); @@ -1559,7 +1550,7 @@ remote_error_cb (WockyPorter *porter, DEBUG ("Force closing of the connection %p", self); priv->closing = TRUE; - wocky_porter_force_close_async (priv->porter, NULL, force_close_cb, + wocky_porter_close_async (priv->porter, 0, NULL, force_close_cb, self); gabble_connection_disconnect_with_tp_error (self, error, reason); @@ -2081,33 +2072,12 @@ closed_cb (GObject *source, gpointer user_data) { GabbleConnection *self = GABBLE_CONNECTION (user_data); - GabbleConnectionPrivate *priv = self->priv; TpBaseConnection *base = TP_BASE_CONNECTION (self); GError *error = NULL; - if (priv->disconnect_timer != 0) - { - /* stop the timer */ - g_source_remove (priv->disconnect_timer); - priv->disconnect_timer = 0; - } - if (!wocky_porter_close_finish (WOCKY_PORTER (source), res, &error)) { DEBUG ("close failed: %s", error->message); - - if (g_error_matches (error, WOCKY_PORTER_ERROR, - WOCKY_PORTER_ERROR_FORCIBLY_CLOSED)) - { - /* Close operation has been aborted because a force_close operation - * has been started. tp_base_connection_finish_shutdown will be - * called once this force_close operation is completed so we don't - * do it here. */ - - g_error_free (error); - return; - } - g_error_free (error); } else @@ -2118,19 +2088,6 @@ closed_cb (GObject *source, tp_base_connection_finish_shutdown (base); } -static gboolean -disconnect_timeout_cb (gpointer data) -{ - GabbleConnection *self = GABBLE_CONNECTION (data); - GabbleConnectionPrivate *priv = self->priv; - - DEBUG ("Close operation timed out. Force closing"); - priv->disconnect_timer = 0; - - wocky_porter_force_close_async (priv->porter, NULL, force_close_cb, self); - return FALSE; -} - static void connection_shut_down (TpBaseConnection *base) { @@ -2148,11 +2105,8 @@ connection_shut_down (TpBaseConnection *base) { DEBUG ("connection may still be open; closing it: %p", base); - g_assert (priv->disconnect_timer == 0); - priv->disconnect_timer = g_timeout_add_seconds (DISCONNECT_TIMEOUT, - disconnect_timeout_cb, self); - - wocky_porter_close_async (priv->porter, NULL, closed_cb, self); + wocky_porter_close_async (priv->porter, DISCONNECT_TIMEOUT, + NULL, closed_cb, self); return; } else if (priv->connector != NULL) |