Hi Patrik,

On 10/18/2013 03:56 PM, Patrik Flykt wrote:

        Hi,

On Thu, 2013-10-10 at 16:58 +0200, Daniel Wagner wrote:
+void __connman_service_auto_disconnect(void)
+{
+       DBG("");
+
+       if (autodisconnect_timeout != 0)
+               return;
+
+       autodisconnect_timeout = g_timeout_add_seconds(0,
run_auto_disconnect, NULL);
+}

This is unnecessary and complicated. Can't the code just disconnect when
the last session requesting it calls disconnect and it gets removed from
whatever structures?

That was my idention to do. Hmm, I think I don't have to decouple
the disconnect call via the main loop.

That could be related to removal from service
struct, but unfortunately I'm a little busy checking the code right now.

There are two ways how to trigger a disconnect(). First, is when
the session goes away and the other is when the application/users
calls Session.Disconnect(). That is what this patch should do.

For disconnection we'd need to track what connected the service, was it
a session, "normal" autoconnect or the user. Only if a session has
requested the service to be connected should the service be disconnected
when the last session disconnects it.

And that is what I have implemented. The session which requests a connection
is tracked and when it calls disconnect() or removes the session then
the services is disconnected (if there is no other session activily
asking for it. That even works together with the Service API.

I think we need some cleanup logic which is tries to get rid of connections.
If I got you right, you would like to see this merged with the
auto_connect_service().

cheers,
daniel
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to