Re: [PATCH BlueZ v8 1/8] core: Mutually exclude concurrent connections

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, Oct 01, 2012, João Paulo Rechi Vita wrote:
>  static gboolean connect_pending_cb(gpointer user_data)
>  {
>  	struct btd_device *device = user_data;
>  	struct btd_adapter *adapter = device_get_adapter(device);
> +	GIOChannel *io;
>  
>  	/* in the future we may want to check here if the controller supports
>  	 * scanning and connecting at the same time */
>  	if (adapter->discovering)
>  		return TRUE;
>  
> -	device_att_connect(device);
> +	if (adapter->connecting)
> +		return TRUE;
> +
> +	adapter->connecting = TRUE;
> +	adapter->waiting_to_connect--;
> +
> +	io = device_att_connect(device);
> +	g_io_add_watch(io, G_IO_OUT | G_IO_ERR, clean_connecting_state,
> +						btd_device_ref(device));

Looks like there is some error handling missing here since
device_att_connect could return NULL;

> +		g_idle_add(connect_pending_cb,  btd_device_ref(device));

Two spaces after the comma here. What's a bit worrying also is that you
don't store the idle id, but I suppose that's safe since you ensure that
this asynchronous operation has it's own reference to the device.

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux