summaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorMikel Astiz <mikel.astiz@bmw-carit.de>2012-09-04 13:15:55 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2012-09-04 15:50:44 +0300
commit5d143ba35e1af7cc090f1c8c53fa4957efd258e2 (patch)
tree1eec79ddb224b84b2eecec1ed696d39385df2f58 /audio
parent10f9408e03ffa3390baf67ba417b91e955af5d28 (diff)
downloadbluez-5d143ba35e1af7cc090f1c8c53fa4957efd258e2.tar.gz
audio: Fix gateway in connecting state forever
If bt_search_service() fails the state should be left unchanged. Otherwise the gateway state is set forever to GATEWAY_STATE_CONNECTING. This issue can be easily reproduced if a connection attempt is done very soon after startup.
Diffstat (limited to 'audio')
-rw-r--r--audio/gateway.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/audio/gateway.c b/audio/gateway.c
index 77a8cb019..860303884 100644
--- a/audio/gateway.c
+++ b/audio/gateway.c
@@ -526,11 +526,18 @@ fail:
static int get_records(struct audio_device *device)
{
uuid_t uuid;
+ int err;
- change_state(device, GATEWAY_STATE_CONNECTING);
sdp_uuid16_create(&uuid, HANDSFREE_AGW_SVCLASS_ID);
- return bt_search_service(&device->src, &device->dst, &uuid,
- get_record_cb, device, NULL);
+
+ err = bt_search_service(&device->src, &device->dst, &uuid,
+ get_record_cb, device, NULL);
+ if (err < 0)
+ return err;
+
+ change_state(device, GATEWAY_STATE_CONNECTING);
+
+ return 0;
}
static DBusMessage *ag_connect(DBusConnection *conn, DBusMessage *msg,