Re: [PATCH BlueZ 1/2] shared/att: Directly close fd on ATT violations.

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

 



Hi Arman,

On Fri, Nov 21, 2014, Arman Uguray wrote:
> +	/*
> +	 * Directly terminate the connection as required by the ATT protocol.
> +	 * This should trigger an io disconnect event which will clean up the
> +	 * io and notify the upper layer.
> +	 */
> +	close(att->fd);
> +
>  	return false;
>  }

Shouldn't you also set att->fd to -1 since its old value is now invalid?
(similar to setting a pointer to NULL after freeing it)

However, wouldn't the more correct thing to do be to use shutdown()
instead of close()? That would guarantee that even in the case of
duplicated fd's the connection would get terminated - close() can be
considered to behave similar to an unref(), i.e. it invalidates the fd
value but only does something to the connection (the same as shutdown)
if there are no other references left.

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