2012-10-02 17:46:40

by Mikel Astiz

[permalink] [raw]
Subject: [PATCH v0] audio: Fix missing gateway state check on Connect

From: Mikel Astiz <[email protected]>

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 a9a576e..b4d96f0 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);

--
1.7.11.4



2012-10-02 18:52:27

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH v0] audio: Fix missing gateway state check on Connect

Hi Mikel,

On Tue, Oct 02, 2012, Mikel Astiz wrote:
> 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(+)

Applied. Thanks.

Johan