From: Daniel Wagner <[email protected]>

Hi,

Tere is the second version of my rework. This version implements all
the session related stuff in session.c, as suggested by Patrik. I am
very pleased with this version because it looks better then what we
had before. 

cheers,
daniel



Orinal cover letter

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 (12):
  session: Remove service selection implementation
  session: Use boolean for tracking connect requests
  session: Move D-Bus notify methods up
  session: Maintain a service to session hash table
  service: Move __connman_service_set_active_session() to session.c
  session: Handle connection type configuration changes
  main: Introduce SessionAutoConnectMode
  connman.conf.5: Add SessionAutoConnectMode documentation
  service: Add auto disconnect support
  service: Allow session to establish a connection
  session: Remove unnecessary session state update
  doc: Update connection managment algorithm

 doc/connman.conf.5       |   10 +
 doc/session-overview.txt |   70 +--
 src/connman.h            |    6 +-
 src/main.c               |   14 +
 src/main.conf            |    7 +
 src/service.c            |   99 +--
 src/session.c            | 1554 +++++++++++++++++++---------------------------
 7 files changed, 742 insertions(+), 1018 deletions(-)

-- 
1.8.4.474.g128a96c

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

Reply via email to