Open Source Telephony
 help / color / mirror / Atom feed
From: Gustavo F. Padovan <padovan@profusion.mobi>
To: ofono@ofono.org
Subject: Re: [PATCH 2/2] bluetooth: Add Bluetooth service authorization support
Date: Fri, 04 Feb 2011 16:08:59 -0200	[thread overview]
Message-ID: <20110204180859.GA2370@joana> (raw)
In-Reply-To: <1296830644-15768-3-git-send-email-frederic.danis@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2241 bytes --]

Hi Frédéric,

* Frédéric Danis <frederic.danis@linux.intel.com> [2011-02-04 15:44:04 +0100]:

> ---
>  plugins/bluetooth.c |  125 ++++++++++++++++++++++++++++++++++++++++++++++----
>  1 files changed, 115 insertions(+), 10 deletions(-)
> 
> diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
> index b489dad..8d28b07 100644
> --- a/plugins/bluetooth.c
> +++ b/plugins/bluetooth.c
> @@ -44,6 +44,8 @@ static GHashTable *adapter_address_hash = NULL;
>  static gint bluetooth_refcount;
>  static GSList *server_list = NULL;
>  
> +#define TIMEOUT (60) /* Timeout for user response (seconds) */
> +
>  struct server {
>  	guint8 channel;
>  	char *sdp_record;
> @@ -58,6 +60,8 @@ struct cb_data {
>  	struct server *server;
>  	char *path;
>  	guint source;
> +	GIOChannel *io;
> +	gboolean pending_auth;
>  };
>  
>  void bluetooth_create_path(const char *dev_addr, const char *adapter_addr,
> @@ -483,26 +487,104 @@ static void cb_data_destroy(gpointer data)
>  	g_free(cb_data);
>  }
>  
> +static void cancel_authorization(struct cb_data *user_data)
> +{
> +	DBusMessage *msg;
> +
> +	if (user_data->path == NULL)
> +		return;
> +
> +	msg = dbus_message_new_method_call(BLUEZ_SERVICE, user_data->path,
> +						BLUEZ_SERVICE_INTERFACE,
> +						"CancelAuthorization");
> +
> +	if (msg == NULL) {
> +		ofono_error("Unable to allocate D-Bus CancelAuthorization"
> +				" message");
> +		return;
> +	}
> +
> +	g_dbus_send_message(connection, msg);
> +}
> +
>  static gboolean client_event(GIOChannel *chan, GIOCondition cond, gpointer data)
>  {
>  	struct cb_data *cb_data = data;
>  	struct server *server = cb_data->server;
>  
> -	server->client_list = g_slist_remove(server->client_list,
> +	if (cb_data->pending_auth == TRUE) {
> +		cancel_authorization(cb_data);
> +
> +		cb_data->pending_auth = FALSE;
> +	} else {
> +		server->client_list = g_slist_remove(server->client_list,
>  					GUINT_TO_POINTER(cb_data->source));
>  
> -	cb_data_destroy(cb_data);
> +		cb_data_destroy(cb_data);
> +	}

Don't you have to call g_slist_remove and cb_data_destroy for both cases? when
pending_auth is TRUE or FALSE.

-- 
Gustavo F. Padovan
http://profusion.mobi

  reply	other threads:[~2011-02-04 18:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-04 14:44 [PATCH v5 0/2] bluetooth: Add bluetooth server support =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-02-04 14:44 ` [PATCH 1/2] " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-02-04 14:44 ` [PATCH 2/2] bluetooth: Add Bluetooth service authorization support =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-02-04 18:08   ` Gustavo F. Padovan [this message]
2011-02-07 16:06     ` Frederic Danis
  -- strict thread matches above, loose matches on Subject: below --
2011-01-28  9:45 [PATCH v4 0/2] bluetooth: Add bluetooth server support =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-01-28  9:45 ` [PATCH 2/2] bluetooth: Add Bluetooth service authorization support =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-01-27 20:20 [PATCH v3 0/2] bluetooth: Add bluetooth server support =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-01-27 20:20 ` [PATCH 2/2] bluetooth: add Bluetooth service authorization support =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis

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=20110204180859.GA2370@joana \
    --to=padovan@profusion.mobi \
    --cc=ofono@ofono.org \
    /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