From: Daniel Wagner <[email protected]>
Hi,
v2:
- Rebases to current head
- Fixed disconnect services when last session disconnects().
This is done by calling __connman_session_auto_connect().
v1:
- Reworked according Patrik's feedback
Moved all session related code to session.c
v0:
- Initial version
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 | 1569 +++++++++++++++++++---------------------------
7 files changed, 751 insertions(+), 1024 deletions(-)
--
1.8.4.474.g128a96c
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman