From: Daniel Wagner <daniel.wag...@bmw-carit.de> In case we didn't select a service (entry) reset the one in the info (deselection). And then we have also take a refence if the reason was CONNECT. --- src/session.c | 23 ++++++++++++++--------- 1 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/src/session.c b/src/session.c index f0b6a20..19771b2 100644 --- a/src/session.c +++ b/src/session.c @@ -823,18 +823,23 @@ static void select_and_connect(struct connman_session *session, if (info->entry != NULL && info->entry != entry) test_and_disconnect(session); - if (entry != NULL) { - info->entry = entry; - info->entry->reason = reason; + if (entry == NULL) { + info->entry = NULL; + return; + } - if (explicit_connect(reason) == TRUE) - __connman_service_session_inc(info->entry->service); + info->entry = entry; + info->entry->reason = reason; - if (do_connect == TRUE) - __connman_service_connect(info->entry->service); - else - info->online = is_online(entry->state); + if (do_connect == TRUE) { + __connman_service_session_inc(info->entry->service); + __connman_service_connect(info->entry->service); + } else if (reason == CONNMAN_SESSION_REASON_CONNECT) { + /* session is already online take ref */ + __connman_service_session_inc(info->entry->service); } + + info->online = is_online(entry->state); } static void session_changed(struct connman_session *session, -- 1.7.6 _______________________________________________ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman