[telepathy-gabble/master] Don't call shut_down() twice on stream errors.
Will Thompson
will.thompson at collabora.co.uk
Mon Oct 19 10:41:11 PDT 2009
This essentially reverts 63d0cd4, which papered over a bug in Wocky
where the callback passed to wocky_porter_force_close_async() would
never be called in slightly obscure situations.
Reviewed-by: Simon McVittie <simon.mcvittie at collabora.co.uk>
---
src/connection.c | 42 +++++++++++++++++++++---------------------
1 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/src/connection.c b/src/connection.c
index 551bd1c..5430051 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -1376,7 +1376,7 @@ remote_error_cb (WockyPorter *porter,
if (domain == WOCKY_XMPP_STREAM_ERROR)
{
/* stream error */
- DEBUG ("Received stream error (%u): %s\n", code, msg);
+ DEBUG ("Received stream error (%u): %s", code, msg);
if (code == WOCKY_XMPP_STREAM_ERROR_CONFLICT)
{
@@ -1896,29 +1896,29 @@ connection_shut_down (TpBaseConnection *base)
GabbleConnection *self = GABBLE_CONNECTION (base);
GabbleConnectionPrivate *priv = self->priv;
- if (!priv->closing)
- {
- priv->closing = TRUE;
+ if (priv->closing)
+ return;
- if (priv->porter != NULL)
- {
- DEBUG ("connection may still be open; closing it: %p", base);
+ priv->closing = TRUE;
- g_assert (priv->disconnect_timer == 0);
- priv->disconnect_timer = g_timeout_add_seconds (DISCONNECT_TIMEOUT,
- disconnect_timeout_cb, self);
+ if (priv->porter != NULL)
+ {
+ DEBUG ("connection may still be open; closing it: %p", base);
- wocky_porter_close_async (priv->porter, NULL, closed_cb, self);
- return;
- }
- else if (priv->connector != NULL)
- {
- /* FIXME: cancel connecting if we are connecting, for now we wait *
- * until the connection is finished and then drop it directly *
- * wocky connector does not support gcancellables yet */
- DEBUG ("wait for connector to finish before closing: %p", base);
- return;
- }
+ 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);
+ return;
+ }
+ else if (priv->connector != NULL)
+ {
+ /* FIXME: cancel connecting if we are connecting, for now we wait *
+ * until the connection is finished and then drop it directly *
+ * wocky connector does not support gcancellables yet */
+ DEBUG ("wait for connector to finish before closing: %p", base);
+ return;
}
DEBUG ("neither porter nor connector is alive: clean up the base connection");
--
1.5.6.5
More information about the telepathy-commits
mailing list