Hi,
On Fri, 2013-12-13 at 09:34 +0100, Daniel Wagner wrote:
> static struct connman_notifier session_notifier = {
> .name = "session",
> - .service_state_changed = service_state_changed,
> - .ipconfig_changed = ipconfig_changed,
> + .service_add = notify_service_add,
> + .service_remove = notify_service_remove,
> + .service_state_changed = notify_service_state_changed,
> + .ipconfig_changed = notify_ipconfig_changed,
> };
By adding the notify_service_add() notifier, session code just
duplicates the service hash in src/service.c without any additional
features. The current implementation uses only a service state changed
notifier as a session does not need to know about all services, only the
connected ones (and when they move out of connected state). For example
all unknown wifi services that happen to be found while scanning will
not bloat the data structure in session and make the service handling
simpler as the connected state need not be checked again in session.c.
Thus I'd drop the service added notifier.
Similar reasoning goes for the service removal notifier. If the service
is disconnected or even removed, it's of no use for the session code and
again there is no need to track it anymore as it's unconnected and can't
be used. This makes it unnecessary for the session code to check service
state, as only connected services are the ones visible in the session
code.
Cheers,
Patrik
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman