Linux bluetooth development
 help / color / mirror / Atom feed
From: Mikel Astiz <mikel.astiz.oss@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Mikel Astiz <mikel.astiz@bmw-carit.de>
Subject: [PATCH v0] audio: Fix missing gateway state check on Connect
Date: Tue,  2 Oct 2012 19:46:40 +0200	[thread overview]
Message-ID: <1349200000-2696-1-git-send-email-mikel.astiz.oss@gmail.com> (raw)

From: Mikel Astiz <mikel.astiz@bmw-carit.de>

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


             reply	other threads:[~2012-10-02 17:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-02 17:46 Mikel Astiz [this message]
2012-10-02 18:52 ` [PATCH v0] audio: Fix missing gateway state check on Connect Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349200000-2696-1-git-send-email-mikel.astiz.oss@gmail.com \
    --to=mikel.astiz.oss@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=mikel.astiz@bmw-carit.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox