5 Connection management algorithm basics
6 ======================================
8 When a session is created, a sorted list of services is added to the
9 session. The services are filtered and stable sorted according
12 - AllowedBearers (filter and sort)
13 - RoamingPolicy (filter and sort)
15 A stable sorting algorithm maintains the relative order.
17 If a service is removed or added all sessions are updated according
20 There are three triggers which lead to evaluate the connect
29 Session.Connect() Offline
31 | Yes +------+-------+ No
32 +------+StayConnected?+------ Do nothing
34 Session.Change() ------+
37 +-----+EmergencyCall?+-----+
38 Yes| +--------------+ |No
40 Connect to +--------------+
41 first available +---+AvoidHandover?+---+
42 Service | +--------------+ |
45 +---+In service_list +---+ |
46 Yes| |and online? | |No |
47 | +----------------+ | |
49 Take that one Take first in
52 There are two triggers which lead to evaluate the disconnect
55 - Session.Disconnect()
65 +-----------------+ Yes
66 |service not used +-------------+
71 Service.Disconnect() Do nothing
74 Session States and Transitions
75 ==============================
77 There are three main strategies for state changes.
83 The initial state for all new sessions is Free Ride.
85 The Free Ride state means that a session will go online if a matching
86 service goes online without calling Service.Connect() itself. The idea
87 behind this is that a session doesn't request a connection for itself
88 instead waits until another session actively requires to go online.
89 This is comparable to piggy-backing.
91 When a session is in the Connect state ConnMan tries to find a
92 matching service (see Connect algorithm) and then decides either to
93 connect the service or delay the request. ConnMan is allowed to
94 connect to the service or to delay it, e.g. group PeriodicConnects
95 together. The session will leave the Connect state when the service
96 goes offline unless StayConnected is True. It will enter the Free Ride
99 When the application calls Disconnect() the session enters the
100 Disconnect state and stays there until the application calls Connect()
104 State Change to offline & StayConnected = True
107 +-----------+ +---------+ -- Disconnect() --> +------------+
108 | Free Ride |-- Connect() -->| Connect | | Disconnect |
109 +-----------+ +---------+ <-- Connect() --- +------------+
111 | +------------------------ + |
112 | State Change to offline & StayConnected = False |
115 +----------------------- Disconnect() -----------------------+
117 Note: this documents the current behavior it is likely to change in near