obex = g_new0(GObex, 1);
- obex->io = io;
+ obex->io = g_io_channel_ref(io);
obex->ref_count = 1;
obex->io_rx_mtu = io_rx_mtu;
cli_sk);
io = g_io_channel_unix_new(cli_sk);
+
g_io_channel_set_flags(io, G_IO_FLAG_NONBLOCK, NULL);
+ g_io_channel_set_close_on_unref(io, TRUE);
obex = g_obex_new(io, G_OBEX_TRANSPORT_STREAM, -1, -1);
+ g_io_channel_unref(io);
g_obex_set_disconnect_function(obex, disconn_func, NULL);
clients = g_slist_append(clients, obex);;
gboolean close_on_unref)
{
GIOChannel *io;
+ GObex *obex;
io = g_io_channel_unix_new(fd);
g_assert(io != NULL);
g_io_channel_set_close_on_unref(io, close_on_unref);
- return g_obex_new(io, transport_type, -1, -1);
+ obex = g_obex_new(io, transport_type, -1, -1);
+ g_io_channel_unref(io);
+
+ return obex;
}
static void create_endpoints(GObex **obex, GIOChannel **io, int sock_type)