static char * socket_address_to_string (GSocketAddress *address) { char *res = NULL; if (G_IS_INET_SOCKET_ADDRESS (address)) { GInetAddress *inet_address; char *str; int port; inet_address = g_inet_socket_address_get_address (G_INET_SOCKET_ADDRESS (address)); str = g_inet_address_to_string (inet_address); port = g_inet_socket_address_get_port (G_INET_SOCKET_ADDRESS (address)); res = g_strdup_printf ("%s:%d", str, port); g_free (str); } #ifdef G_OS_UNIX else if (G_IS_UNIX_SOCKET_ADDRESS (address)) { GUnixSocketAddress *uaddr = G_UNIX_SOCKET_ADDRESS (address); res = g_strdup_printf ("%s:%s", unix_socket_address_types[g_unix_socket_address_get_address_type (uaddr)], g_unix_socket_address_get_path (uaddr)); } #endif return res; }
static void tp_stream_tube_channel_dispose (GObject *obj) { TpStreamTubeChannel *self = (TpStreamTubeChannel *) obj; if (self->priv->service != NULL) { g_socket_service_stop (self->priv->service); tp_clear_object (&self->priv->service); } tp_clear_object (&self->priv->result); tp_clear_pointer (&self->priv->parameters, g_hash_table_unref); g_slist_foreach (self->priv->conn_waiting_sig, (GFunc) conn_waiting_sig_free, NULL); tp_clear_pointer (&self->priv->conn_waiting_sig, g_slist_free); g_slist_foreach (self->priv->sig_waiting_conn, (GFunc) sig_waiting_conn_free, NULL); tp_clear_pointer (&self->priv->sig_waiting_conn, g_slist_free); if (self->priv->tube_connections != NULL) { GHashTableIter iter; gpointer conn; g_hash_table_iter_init (&iter, self->priv->tube_connections); while (g_hash_table_iter_next (&iter, NULL, &conn)) { g_object_weak_unref (conn, remote_connection_destroyed_cb, self); } g_hash_table_unref (self->priv->tube_connections); self->priv->tube_connections = NULL; } if (self->priv->address != NULL) { #ifdef HAVE_GIO_UNIX /* check if we need to remove the temporary file we created */ if (G_IS_UNIX_SOCKET_ADDRESS (self->priv->address)) { const gchar *path; path = g_unix_socket_address_get_path ( G_UNIX_SOCKET_ADDRESS (self->priv->address)); g_unlink (path); } #endif /* HAVE_GIO_UNIX */ g_object_unref (self->priv->address); self->priv->address = NULL; } tp_clear_pointer (&self->priv->access_control_param, tp_g_value_slice_free); tp_clear_object (&self->priv->local_conn_waiting_id); tp_clear_object (&self->priv->client_socket); G_OBJECT_CLASS (tp_stream_tube_channel_parent_class)->dispose (obj); }