diff options
-rw-r--r-- | audio/avdtp.c | 15 |
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: |