Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCHv2] Fix plugin close & disconnect functions call order
@ 2011-01-14 10:04 lkslawek
  2011-01-14 11:54 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: lkslawek @ 2011-01-14 10:04 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Slawomir Bochenski

From: Slawomir Bochenski <lkslawek@gmail.com>

Normally during an OBEX session, calling sequence

service->connect - [driver->open - driver->close]* - service->disconnect

is kept. The only exception to this when the connection is reset
(when no ABORT was sent) during transfer. Then the sequence is:

service->connect - [driver->open - driver->close]* - driver->open -
service->disconnect - driver->close

This patch fixes it, so memory managament of session/transfer data in
service plugin can be easier.
---
 src/obex.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/obex.c b/src/obex.c
index 65f17fc..e45ed74 100644
--- a/src/obex.c
+++ b/src/obex.c
@@ -317,8 +317,6 @@ static void obex_session_free(struct obex_session *os)
 {
 	sessions = g_slist_remove(sessions, os);
 
-	os_reset_session(os);
-
 	if (os->io)
 		g_io_channel_unref(os->io);
 
@@ -1231,6 +1229,8 @@ static void obex_handle_destroy(void *user_data)
 
 	os = OBEX_GetUserData(obex);
 
+	os_reset_session(os);
+
 	if (os->service && os->service->disconnect)
 		os->service->disconnect(os, os->service_data);
 
-- 
1.7.1


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

* Re: [PATCHv2] Fix plugin close & disconnect functions call order
  2011-01-14 10:04 [PATCHv2] Fix plugin close & disconnect functions call order lkslawek
@ 2011-01-14 11:54 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2011-01-14 11:54 UTC (permalink / raw)
  To: lkslawek; +Cc: linux-bluetooth

Hi Slawek,

On Fri, Jan 14, 2011, lkslawek@gmail.com wrote:
> From: Slawomir Bochenski <lkslawek@gmail.com>
> 
> Normally during an OBEX session, calling sequence
> 
> service->connect - [driver->open - driver->close]* - service->disconnect
> 
> is kept. The only exception to this when the connection is reset
> (when no ABORT was sent) during transfer. Then the sequence is:
> 
> service->connect - [driver->open - driver->close]* - driver->open -
> service->disconnect - driver->close
> 
> This patch fixes it, so memory managament of session/transfer data in
> service plugin can be easier.
> ---
>  src/obex.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

Pushed upstream. Thanks.

Johan

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

end of thread, other threads:[~2011-01-14 11:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-14 10:04 [PATCHv2] Fix plugin close & disconnect functions call order lkslawek
2011-01-14 11:54 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox