From 773b25a93057bd13e190e8fe2ea0505f3d2389e1 Mon Sep 17 00:00:00 2001 From: Mikel Astiz Date: Tue, 2 Oct 2012 19:46:40 +0200 Subject: [PATCH] audio: Fix missing gateway state check on Connect If the gateway is already connected (or connecting) when Connect() is called, an error should be returned, exactly as other interfaces do. --- audio/gateway.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/audio/gateway.c b/audio/gateway.c index a9a576edb..b4d96f0c6 100644 --- a/audio/gateway.c +++ b/audio/gateway.c @@ -572,6 +572,11 @@ static DBusMessage *ag_connect(DBusConnection *conn, DBusMessage *msg, struct gateway *gw = au_dev->gateway; int err; + if (gw->state == GATEWAY_STATE_CONNECTING) + return btd_error_in_progress(msg); + else if (gw->state > GATEWAY_STATE_CONNECTING) + return btd_error_already_connected(msg); + if (!gw->agent) return btd_error_agent_not_available(msg); -- 2.47.3