Hi,

On 10/10/2013 04:58 PM, Daniel Wagner wrote:
From: Daniel Wagner <[email protected]>

Hi,

This is what I announced as the second part of the session
cleanup. Since it is a bit more than just a cleanup, I renamed the
series.

Anyway, this series is a complete overhaul of the session selection
algorithm. Instead of trying to do the service selection in session.c
we drop back to do this work in service.c. It turns out that this
is pretty straight forward and works really nicely.

This is how all works:
  - session.c exposes which the configuration and the connection request
  - when a session is created, session.c tells via
    __connman_service_set_active_session() to consider the newly created
    session.
  - service.c keeps for a list of sessions for each service which match
  - when the service state changes all sessions associated to the
    service will be updated if the READY/ONLINE state is entered or left.
  - the decision which service to connect is done by the normal
    auto_connect_service() function. no change on the logic there.

As usual there is one point though to consider. Since the auto connect
algorithm is used, the AutoConnect flag needs to be interpreted
slightly different. In order not to disturb any existing users the
SessionAutoConnectMode configuration flag is introduced.

When AutoConnect is set to true (and SessionAutoConnectMode=true) the
service is only connected to when there is a session user for it.
That is Session.Connect() has been called. When no session is
interested in a connection (all have either called
Session.Disconnect() or never called Session.Connect()) then the
system stays idle. A very popular use-case for me :)

Note that all Service API actions over rule the Session API actions,
e.g. Session.Connect() establishes a connection, it is still possible
to disconnect via Service.Disconnect().

The whole series is also available on github:

https://github.com/bmwcarit/connman/commits/refactor-v2

Meanwhile I have updated the 'session: Add service name match'
RFC series on top of this series. There are still a few small
hickups when changing settings, but nothing really big.

In case anyone wants to test or play with it, get the whole
change set via:

https://github.com/bmwcarit/connman/commits/policy-services-v5

cheers,
daniel



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

Reply via email to