summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2011-04-01 14:48:10 +0100
committerJonny Lamb <jonny.lamb@collabora.co.uk>2011-04-01 14:48:10 +0100
commit35dd2dc08c83bd24af209b952dff8f6f9c075161 (patch)
tree87b23cd0403f09f394aac159520ef0756212f878
parent1769216bed3a8633cebd1e15bc79d0cb72bb3088 (diff)
meta-porter: don't assert if we have another connection
It turns out this assertion was being hit a little too often and it was actually somewhat feasible. Let's clear up new connections when they're not needed. I thought about adding some kind of support for multiple porters for this case but it got a bit hairy and I feel that if you already have an open connection to a contact and another appears, this is possibly a bug elsewhere. Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r--wocky/wocky-meta-porter.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/wocky/wocky-meta-porter.c b/wocky/wocky-meta-porter.c
index 0acc5a2..edd1d95 100644
--- a/wocky/wocky-meta-porter.c
+++ b/wocky/wocky-meta-porter.c
@@ -256,9 +256,20 @@ create_porter (WockyMetaPorter *self,
if (data != NULL)
{
- g_assert (data->porter == NULL);
-
- data->porter = wocky_c2s_porter_new (connection, priv->jid);
+ if (data->porter != NULL)
+ {
+ /* close the new one; this function is meant to have stolen
+ * a reference to the connection so we don't need to unref
+ * it. It will ref itself for the duration of this close
+ * call. */
+ wocky_xmpp_connection_send_close_async (connection,
+ NULL, NULL, NULL);
+ return data->porter;
+ }
+ else
+ {
+ data->porter = wocky_c2s_porter_new (connection, priv->jid);
+ }
}
else
{