summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2009-02-06 15:00:24 -0800
committerJohan Hedberg <johan.hedberg@nokia.com>2009-02-06 15:00:24 -0800
commitb151a8da90d31db611a6c0976252fbc06d93916d (patch)
tree9ba86931a5918e8b05cec99216429a34f4ba0779
parent36941ab91a9ca620537ec892018cc0bdd3b661a2 (diff)
Fix authorization cancelation when connection drops
-rw-r--r--audio/avdtp.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/audio/avdtp.c b/audio/avdtp.c
index 4c95fa49..a7960f25 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -888,6 +888,7 @@ static void release_stream(struct avdtp_stream *stream, struct avdtp *session)
static void connection_lost(struct avdtp *session, int err)
{
struct audio_device *dev;
+ char address[18];
dev = manager_find_device(&session->dst, AUDIO_CONTROL_INTERFACE,
FALSE);
@@ -896,13 +897,11 @@ static void connection_lost(struct avdtp *session, int err)
avrcp_disconnect(dev);
}
- if (session->state == AVDTP_SESSION_STATE_CONNECTED) {
- char address[18];
+ ba2str(&session->dst, address);
+ debug("Disconnected from %s", address);
- ba2str(&session->dst, address);
- debug("Disconnected from %s", address);
- } else if (session->state == AVDTP_SESSION_STATE_CONNECTING)
- btd_cancel_authorization(&dev->src, &dev->dst);
+ if (session->state == AVDTP_SESSION_STATE_CONNECTING)
+ btd_cancel_authorization(&session->server->src, &session->dst);
session->free_lock = 1;
@@ -3053,7 +3052,7 @@ static void avdtp_server_cb(GIOChannel *chan, int err, const bdaddr_t *src,
session->io = g_io_add_watch(chan, G_IO_ERR | G_IO_HUP | G_IO_NVAL,
(GIOFunc) session_cb, session);
err = btd_request_authorization(src, dst, ADVANCED_AUDIO_UUID,
- auth_cb, session);
+ auth_cb, session);
if (err < 0) {
avdtp_unref(session);
goto drop;
@@ -3061,6 +3060,8 @@ static void avdtp_server_cb(GIOChannel *chan, int err, const bdaddr_t *src,
g_io_channel_unref(chan);
+ session->state = AVDTP_SESSION_STATE_CONNECTING;
+
return;
drop: