Re: [PATCH v2] gattrib: Fix a request/response command deadlock |
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Hi Ido,
On 04:20 Tue 29 May, Ido Yariv wrote:
> New requests and responses are never sent if a request was sent and the
> response for it hasn't been received yet. As a result, if both end
> points send requests at the same time, a deadlock could occur. This
> could happen, for instance, if the client sends a read request and the
> server sends an indication before responding to the read request.
>
> Fix this by introducing an additional queue for responses. Responses may
> be sent while there's still a pending request/indication.
> ---
> attrib/gattrib.c | 107 ++++++++++++++++++++++++++++++++++++++++++------------
> 1 files changed, 83 insertions(+), 24 deletions(-)
>
> diff --git a/attrib/gattrib.c b/attrib/gattrib.c
> index 769be36..71c94d8 100644
> --- a/attrib/gattrib.c
> +++ b/attrib/gattrib.c
[snip]
> @@ -504,12 +554,21 @@ gboolean g_attrib_cancel_all(GAttrib *attrib)
>
> if (head) {
> /* ... and put it back in the queue */
> - g_queue_push_head(attrib->queue, head);
> + g_queue_push_head(queue, head);
> }
>
> return TRUE;
> }
>
> +gboolean g_attrib_cancel_all(GAttrib *attrib)
> +{
> + if (attrib == NULL)
> + return FALSE;
> +
> + return cancel_all_per_queue(attrib->requests) &&
> + cancel_all_per_queue(attrib->responses);
Sorry, but I just noticed something, even if it's very unlikely that it would
happen in practice: if attrib->requests is NULL, it wouldn't cancel the
responses.
> +}
> +
> gboolean g_attrib_set_debug(GAttrib *attrib,
> GAttribDebugFunc func, gpointer user_data)
> {
> --
> 1.7.7.6
>
Cheers,
--
Vinicius
--
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
[Bluez Devel]
[Linux USB Devel]
[Video for Linux]
[Linux Audio Users]
[Photo]
[Yosemite News]
[Yosemite Photos]
[Free Online Dating]
[Bluez Devel]
[Linux Kernel]
[Linux SCSI]
[XFree86]
[Devices]
[Big List of Linux Books]