[Bug 34932] Use WockyMetaPorter

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Mar 24 12:36:03 CET 2011


https://bugs.freedesktop.org/show_bug.cgi?id=34932

--- Comment #5 from Jonny Lamb <jonny.lamb at collabora.co.uk> 2011-03-24 04:36:02 PDT ---
(In reply to comment #3)
> Yeah, unreffing that NULL stanza is gonna end well. :þ

Oops!

> This is wrong. 'done' is not specific to 'self', so only the first
> GibberBytestreamIBB will ever work.
> 
> Also, I'd just add
> 
> +        if (priv->porter != NULL && priv->contact != NULL)
> +          make_porter_connections (self);
> 
> to _constructed(), and then you wouldn't need to track whether it's been done
> or not.

Done.

> Ditto OOB.

Done.

> +  conn = wocky_meta_porter_borrow_connection (WOCKY_META_PORTER
> (priv->porter),
> +      priv->contact);
> +
> +  if (conn != NULL)
> +    socket_address = g_socket_connection_get_remote_address (conn, NULL);
> +
> +  if (conn == NULL || socket_address == NULL)
> +    {
> +      /* I'm too lazy to create more specific errors for this  as it should
> +       * never happen while using salut anyway.. */
> +      GError e = { GIBBER_XMPP_ERROR, XMPP_ERROR_ITEM_NOT_FOUND,
> +          "Unsable get socket address for the control connection" };
> +      DEBUG ("Could not get socket address for the control connection" );
> +      gibber_bytestream_iface_close (GIBBER_BYTESTREAM_IFACE (self), &e);
> +      goto out;
> +    }
> +
> +  if (!g_socket_address_to_native (G_SOCKET_ADDRESS (address),
> &(addr.storage),
> +          sizeof (addr.storage), &error))
> +    {
> +      GError e = { GIBBER_XMPP_ERROR, XMPP_ERROR_ITEM_NOT_FOUND,
> +          "Failed to turn socket address into bytes" };
> +      DEBUG ("Failed to get native socket address: %s", error->message);
> +      gibber_bytestream_iface_close (GIBBER_BYTESTREAM_IFACE (self), &e);
> +      g_clear_error (&error);
> +      goto out;
> +    }
> +
> +  g_object_unref (socket_address);
> +
> 
> The second error path leaks socket_address. And do you really mean to get a
> GSocketAddress, cast some other random thing to a GSocketAddress and call a
> method on it, and then unref the GSocketAddress you grabbed, unused?

Why didn't the compiler warn me about using an assigned variable I wonder.

Actually I think socket_address can be leaked in the first error path too.
Anyway, fixed.

> http://cgit.freedesktop.org/~jonny/telepathy-salut/commit/?h=meta-porter&id=a6bf9ee54e934988f59a3d3296e3cc476b1bb703
> 
> What's the effect of this? Does gibber_file_transfer_is_file_offer() check that
> from is not NULL?

I can't actually remember, but I hit this problem at some point. The problem
was something like that the stanza wasn't for us and the from contact wasn't
set for some reason... Sorry I can't remember the actual reason.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the telepathy-bugs mailing list