As Guillaume said in <https://bugzilla.gnome.org/show_bug.cgi?id=631314>, "Most of the time when I create an UNIX socket, I don't care about its path and just want a socket in the temporary directory." At the moment we use tmpnam(), which makes the compiler warn (we are in fact using it safely, as far as I can see, but the compiler can't know that). This branch replaces _tp_create_temp_unix_socket with a function following Dan Winship's suggestions on the GNOME bug.
I assume the branch is actually http://git.collabora.co.uk/?p=user/smcv/telepathy-glib-smcv.git;a=shortlog;h=refs/heads/unix Looks good.
Guillaume has reviewed up to and including 1820295f15ee. Following discussion on the GNOME bug regarding portability, I'm not entirely happy with this; I've updated the branch to use a private subdirectory, and added a cleanup function which unlinks the path and removes the directory. More discussion on the GNOME bug -> over there.
Implementation r+ from Guillaume up to 99edd4b0d3769, but I'm waiting for the API ideas on the GNOME bug to settle.
The need to clean up the temporary directory meant I wanted a better cleanup function, so I encapsulated the "listening thing" as a mini-object. We now have this API: typedef struct _TpUnixListener TpUnixListener; TpUnixListener *tp_unix_listener_new (const gchar *hint, GSocketType type, GError **error); GSocket *tp_unix_listener_get_socket (TpUnixListener *self); /* really returns a GUnixSocketAddress, transfer none */ GSocketAddress *tp_unix_listener_get_address (TpUnixListener *self); const gchar *tp_unix_listener_get_path (TpUnixListener *self, gsize *len); void tp_unix_listener_free (TpUnixListener *self); A non-NULL TpUnixListener can only be created on Unix.
Hardcoding "/stream" while the socket could, in theory, have a different GSocketType seems a bit weird. I'm not a big fan of struct as pseudo object. From my experience, we often ends up at some point missing it not being a proper GObject (when you need to pass ref without needing a _copy() for example). This object would be a real object in a proper OOo language.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/telepathy/telepathy-glib/issues/45.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.