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().

cheers,
daniel

Daniel Wagner (11):
  session: Stop tracing services
  session: Use boolean for tracking connect requests
  session: Add internal session API for service layer
  service: Track all active sessions
  service: Add/remove services to/from sessions when state changes
  main: Introduce SessionAutoConnectMode
  service: Allow session to establish a connection
  service: Remove active_sessions
  service: Add auto disconnect function
  session: Unlink dependency between reason 'connect' and bearer config
  session: Handle connection type configuration changes

 src/connman.h |  18 +-
 src/main.c    |  14 ++
 src/main.conf |   7 +
 src/service.c | 281 +++++++++++++++++++---
 src/session.c | 736 ++++++++++------------------------------------------------
 5 files changed, 411 insertions(+), 645 deletions(-)

-- 
1.8.4.474.g128a96c

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

Reply via email to