summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2007-06-06 09:12:42 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2007-06-06 09:12:42 +0000
commit77c1d7b9ca0e99693fd084f5541fb175f3002e6b (patch)
tree8bc4661bfd14dece45088b54faece5c85436c3ff /audio
parentd61880a2d81b1d7a56d2377a8a5063106a10d2f4 (diff)
Properly handle a SCO connect() succeeding on the first try
Diffstat (limited to 'audio')
-rw-r--r--audio/headset.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/audio/headset.c b/audio/headset.c
index 78579b5e..a3921d36 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -1325,6 +1325,7 @@ static DBusHandlerResult hs_play(DBusConnection *conn, DBusMessage *msg,
struct headset *hs = device->headset;
struct sockaddr_sco addr;
struct pending_connect *c;
+ gboolean do_callback = FALSE;
int sk, err;
if (hs->state < HEADSET_STATE_CONNECTED)
@@ -1386,19 +1387,19 @@ static DBusHandlerResult hs_play(DBusConnection *conn, DBusMessage *msg,
}
debug("SCO connect in progress");
-
- hs->state = HEADSET_STATE_PLAY_IN_PROGRESS;
-
g_io_add_watch(c->io, G_IO_OUT | G_IO_NVAL,
(GIOFunc) sco_connect_cb, device);
} else {
debug("SCO connect succeeded with first try");
- hs->state = HEADSET_STATE_PLAY_IN_PROGRESS;
- sco_connect_cb(c->io, G_IO_OUT, device);
+ do_callback = TRUE;
}
+ hs->state = HEADSET_STATE_PLAY_IN_PROGRESS;
hs->pending_connect = c;
+ if (do_callback)
+ sco_connect_cb(c->io, G_IO_OUT, device);
+
return 0;
failed: