From 78a94059160d7478624cad315022255f7ebbbe80 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sun, 19 Aug 2007 15:27:56 +0000 Subject: Improve handling of unix clients which stay connected even though the headset connection is lost --- audio/a2dp.c | 3 ++- audio/avdtp.c | 7 ------- audio/unix.c | 5 +++++ 3 files changed, 7 insertions(+), 8 deletions(-) (limited to 'audio') diff --git a/audio/a2dp.c b/audio/a2dp.c index ce50c9cf..ebf6b472 100644 --- a/audio/a2dp.c +++ b/audio/a2dp.c @@ -118,10 +118,11 @@ static void setup_callback(struct a2dp_stream_cb *cb, cb->cb(s->session, s->dev, s->stream, cb->user_data); } -static void finalize_stream_setup(struct a2dp_stream_setup *s) +static gboolean finalize_stream_setup(struct a2dp_stream_setup *s) { g_slist_foreach(setup->cb, (GFunc) setup_callback, setup); stream_setup_free(setup); + return FALSE; } static gboolean setconf_ind(struct avdtp *session, diff --git a/audio/avdtp.c b/audio/avdtp.c index 993bf89c..a82f21d5 100644 --- a/audio/avdtp.c +++ b/audio/avdtp.c @@ -1518,7 +1518,6 @@ static gboolean request_timeout(gpointer user_data) struct avdtp *session = user_data; struct pending_req *req; struct seid_req sreq; - struct avdtp_remote_sep *rsep; struct avdtp_local_sep *lsep; struct avdtp_stream *stream; uint8_t seid; @@ -1531,12 +1530,6 @@ static gboolean request_timeout(gpointer user_data) seid = ((struct seid_req *) (req->msg))->acp_seid; - rsep = find_remote_sep(session->seps, seid); - if (!rsep) { - error("Unable to find matching remote SEID %u", seid); - goto failed; - } - stream = find_stream_by_rseid(session, seid); if (stream) diff --git a/audio/unix.c b/audio/unix.c index 94c84500..f8832c91 100644 --- a/audio/unix.c +++ b/audio/unix.c @@ -164,6 +164,8 @@ static void stream_state_changed(struct avdtp_stream *stream, switch (new_state) { case AVDTP_STATE_IDLE: + a2dp_source_unlock(client->dev, a2dp->session); + client->dev = NULL; if (a2dp->session) { avdtp_unref(a2dp->session); a2dp->session = NULL; @@ -315,6 +317,7 @@ proceed: client); if (id == 0) { error("request_stream failed"); + a2dp_source_unlock(dev, a2dp->session); goto failed; } @@ -395,6 +398,8 @@ static gboolean client_cb(GIOChannel *chan, GIOCondition cond, gpointer data) if (cond & (G_IO_HUP | G_IO_ERR)) { debug("Unix client disconnected"); + if (!client->dev) + goto failed; if (client->disconnect) client->disconnect(client->dev, cb_data); if (client->type == TYPE_SINK && client->req_id > 0) -- cgit