Hi Szymon, On Wed, Oct 17, 2012 at 9:28 AM, Szymon Janc <szymon.janc@xxxxxxxxx> wrote: > On Tuesday 16 of October 2012 20:34:47 Luiz Augusto von Dentz wrote: >> Hi Szymon, > > Hi Luiz, > >> > if (session->io) { >> > g_io_channel_shutdown(session->io, FALSE, NULL); >> > @@ -1173,8 +1172,6 @@ static void connection_lost(struct avdtp *session, int err) >> > session->io = NULL; >> > } >> > >> > - avdtp_set_state(session, AVDTP_SESSION_STATE_DISCONNECTED); >> >> This is actually the one that we need in case we got disconnect by >> remote after discovery completes. avctp.c has a similar structure to >> handler such states, but without the refcounting all is much simpler. > > OK > >> >> > if (session->io_id) { >> > g_source_remove(session->io_id); >> > session->io_id = 0; >> > @@ -1221,9 +1218,6 @@ void avdtp_unref(struct avdtp *session) >> > >> > if (session->io) >> > set_disconnect_timer(session); >> > - else if (!session->free_lock) /* Drop the local ref if we >> > - aren't connected */ >> > - session->ref--; >> > } >> > >> > if (session->ref > 0) >> > -- >> > 1.7.9.5 >> >> We should probably get rid of the free_lock as well. > > Well, this is what this patch does, doesn't it?:) What about the attached patch, it should fix the references for good by using the dc_timer when the reference drops to 0, I just need to check if 1 second is enough to cover all cases including the ones where the remote device connects but doesn't setup any stream, with the devices I have 1 second seems enough. -- Luiz Augusto von Dentz
Attachment:
0001-AVDTP-Do-not-keep-a-internal-reference.patch
Description: Binary data