linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH obexd v2 1/2] client: fix unreported canceled transfers
@ 2012-02-28 12:56 Mikel Astiz
  2012-02-28 12:56 ` [PATCH obexd v2 2/2] client: free active transfer on session shutdown Mikel Astiz
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mikel Astiz @ 2012-02-28 12:56 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz

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

A session can be shut down from D-Bus, and therefore the pending
transfer callbacks must be reported.
---
 client/session.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/client/session.c b/client/session.c
index 417295e..c4645fb 100644
--- a/client/session.c
+++ b/client/session.c
@@ -485,12 +485,25 @@ proceed:
 
 void obc_session_shutdown(struct obc_session *session)
 {
+	struct pending_request *p;
+	GError *err;
+
 	DBG("%p", session);
 
 	obc_session_ref(session);
 
 	/* Unregister any pending transfer */
-	g_queue_foreach(session->queue, (GFunc) pending_request_free, NULL);
+	err = g_error_new(OBEX_IO_ERROR, OBEX_IO_DISCONNECTED,
+						"Session closed by user");
+
+	while ((p = g_queue_pop_head(session->queue))) {
+		if (p->func)
+			p->func(session, err, p->data);
+
+		pending_request_free(p);
+	}
+
+	g_error_free(err);
 
 	/* Unregister interfaces */
 	if (session->path)
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH obexd v2 2/2] client: free active transfer on session shutdown
  2012-02-28 12:56 [PATCH obexd v2 1/2] client: fix unreported canceled transfers Mikel Astiz
@ 2012-02-28 12:56 ` Mikel Astiz
  2012-02-28 13:06   ` Luiz Augusto von Dentz
  2012-02-28 13:05 ` [PATCH obexd v2 1/2] client: fix unreported canceled transfers Luiz Augusto von Dentz
  2012-03-01  1:47 ` Johan Hedberg
  2 siblings, 1 reply; 5+ messages in thread
From: Mikel Astiz @ 2012-02-28 12:56 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz

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

The currently active request should be canceled just like any other
queued transfer. Otherwise obex timeout is reported.
---
 client/session.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/client/session.c b/client/session.c
index c4645fb..42eba10 100644
--- a/client/session.c
+++ b/client/session.c
@@ -496,6 +496,14 @@ void obc_session_shutdown(struct obc_session *session)
 	err = g_error_new(OBEX_IO_ERROR, OBEX_IO_DISCONNECTED,
 						"Session closed by user");
 
+	if (session->p != NULL) {
+		if (session->p->func)
+			session->p->func(session, err, session->p->data);
+
+		pending_request_free(session->p);
+		session->p = NULL;
+	}
+
 	while ((p = g_queue_pop_head(session->queue))) {
 		if (p->func)
 			p->func(session, err, p->data);
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH obexd v2 1/2] client: fix unreported canceled transfers
  2012-02-28 12:56 [PATCH obexd v2 1/2] client: fix unreported canceled transfers Mikel Astiz
  2012-02-28 12:56 ` [PATCH obexd v2 2/2] client: free active transfer on session shutdown Mikel Astiz
@ 2012-02-28 13:05 ` Luiz Augusto von Dentz
  2012-03-01  1:47 ` Johan Hedberg
  2 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2012-02-28 13:05 UTC (permalink / raw)
  To: Mikel Astiz; +Cc: linux-bluetooth, Mikel Astiz

Hi Mikel,

On Tue, Feb 28, 2012 at 2:56 PM, Mikel Astiz <mikel.astiz.oss@gmail.com> wrote:
> From: Mikel Astiz <mikel.astiz@bmw-carit.de>
>
> A session can be shut down from D-Bus, and therefore the pending
> transfer callbacks must be reported.
> ---
>  client/session.c |   15 ++++++++++++++-
>  1 files changed, 14 insertions(+), 1 deletions(-)
>
> diff --git a/client/session.c b/client/session.c
> index 417295e..c4645fb 100644
> --- a/client/session.c
> +++ b/client/session.c
> @@ -485,12 +485,25 @@ proceed:
>
>  void obc_session_shutdown(struct obc_session *session)
>  {
> +       struct pending_request *p;
> +       GError *err;
> +
>        DBG("%p", session);
>
>        obc_session_ref(session);
>
>        /* Unregister any pending transfer */
> -       g_queue_foreach(session->queue, (GFunc) pending_request_free, NULL);
> +       err = g_error_new(OBEX_IO_ERROR, OBEX_IO_DISCONNECTED,
> +                                               "Session closed by user");
> +
> +       while ((p = g_queue_pop_head(session->queue))) {
> +               if (p->func)
> +                       p->func(session, err, p->data);
> +
> +               pending_request_free(p);
> +       }
> +
> +       g_error_free(err);
>
>        /* Unregister interfaces */
>        if (session->path)
> --
> 1.7.6.5

Ack

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH obexd v2 2/2] client: free active transfer on session shutdown
  2012-02-28 12:56 ` [PATCH obexd v2 2/2] client: free active transfer on session shutdown Mikel Astiz
@ 2012-02-28 13:06   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2012-02-28 13:06 UTC (permalink / raw)
  To: Mikel Astiz; +Cc: linux-bluetooth, Mikel Astiz

Hi Mikel,

On Tue, Feb 28, 2012 at 2:56 PM, Mikel Astiz <mikel.astiz.oss@gmail.com> wrote:
> From: Mikel Astiz <mikel.astiz@bmw-carit.de>
>
> The currently active request should be canceled just like any other
> queued transfer. Otherwise obex timeout is reported.
> ---
>  client/session.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/client/session.c b/client/session.c
> index c4645fb..42eba10 100644
> --- a/client/session.c
> +++ b/client/session.c
> @@ -496,6 +496,14 @@ void obc_session_shutdown(struct obc_session *session)
>        err = g_error_new(OBEX_IO_ERROR, OBEX_IO_DISCONNECTED,
>                                                "Session closed by user");
>
> +       if (session->p != NULL) {
> +               if (session->p->func)
> +                       session->p->func(session, err, session->p->data);
> +
> +               pending_request_free(session->p);
> +               session->p = NULL;
> +       }
> +
>        while ((p = g_queue_pop_head(session->queue))) {
>                if (p->func)
>                        p->func(session, err, p->data);
> --
> 1.7.6.5

Ack.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH obexd v2 1/2] client: fix unreported canceled transfers
  2012-02-28 12:56 [PATCH obexd v2 1/2] client: fix unreported canceled transfers Mikel Astiz
  2012-02-28 12:56 ` [PATCH obexd v2 2/2] client: free active transfer on session shutdown Mikel Astiz
  2012-02-28 13:05 ` [PATCH obexd v2 1/2] client: fix unreported canceled transfers Luiz Augusto von Dentz
@ 2012-03-01  1:47 ` Johan Hedberg
  2 siblings, 0 replies; 5+ messages in thread
From: Johan Hedberg @ 2012-03-01  1:47 UTC (permalink / raw)
  To: Mikel Astiz; +Cc: linux-bluetooth, Mikel Astiz

Hi Mikel,

On Tue, Feb 28, 2012, Mikel Astiz wrote:
> A session can be shut down from D-Bus, and therefore the pending
> transfer callbacks must be reported.
> ---
>  client/session.c |   15 ++++++++++++++-
>  1 files changed, 14 insertions(+), 1 deletions(-)

Both patches have been applied. Thanks.

Johan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-03-01  1:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-28 12:56 [PATCH obexd v2 1/2] client: fix unreported canceled transfers Mikel Astiz
2012-02-28 12:56 ` [PATCH obexd v2 2/2] client: free active transfer on session shutdown Mikel Astiz
2012-02-28 13:06   ` Luiz Augusto von Dentz
2012-02-28 13:05 ` [PATCH obexd v2 1/2] client: fix unreported canceled transfers Luiz Augusto von Dentz
2012-03-01  1:47 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).