summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2009-03-05 10:13:45 -0300
committerJohan Hedberg <johan.hedberg@nokia.com>2009-03-05 10:55:34 -0300
commit3294d4df5f170aabc7663d79b3ca00f6961818b7 (patch)
treefaf7463ce6fed1f5996b9004718b8e5a1afae6dd
parentb9e35900865a26486c331f5feeccaec997f822fc (diff)
Set avdtp session watch to low priority.
The session watch should be low priority because on old kernels (prior to DEFER_SETUP). This is needed for stream Open & Start because the connection is automatically accepted and makes the remote device to sending the Start command imediately. Since both the stream transport connection and the Start command arrive so close to each other the kernel might wake up bluetoothd at the same time for both.
-rw-r--r--audio/avdtp.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/audio/avdtp.c b/audio/avdtp.c
index 2b90b0df..c92bf83c 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -1903,10 +1903,20 @@ static void avdtp_connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
session->buf = g_malloc0(session->imtu);
session->state = AVDTP_SESSION_STATE_CONNECTED;
- session->io_id = g_io_add_watch(chan,
+
+ /* This watch should be low priority since otherwise the
+ * connect callback might be dispatched before the session
+ * callback if the kernel wakes us up at the same time for
+ * them. This could happen if a headset is very quick in
+ * sending the Start command after connecting the stream
+ * transport channel.
+ */
+ session->io_id = g_io_add_watch_full(chan,
+ G_PRIORITY_LOW,
G_IO_IN | G_IO_ERR | G_IO_HUP
| G_IO_NVAL,
- (GIOFunc) session_cb, session);
+ (GIOFunc) session_cb, session,
+ NULL);
if (session->stream_setup) {
set_disconnect_timer(session);