diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2011-08-22 14:49:15 +0200 |
---|---|---|
committer | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2011-08-23 17:22:29 +0200 |
commit | 22a198e642da298a66fc5cb3e9b6e246dbd972b6 (patch) | |
tree | 7a253b1d3090625568be75df43f3e7e0ab1b1eba | |
parent | 74187e2ea8e7bef901f8d0273c8486085fe5ea0a (diff) | |
download | connman-22a198e642da298a66fc5cb3e9b6e246dbd972b6.tar.gz connman-22a198e642da298a66fc5cb3e9b6e246dbd972b6.tar.bz2 connman-22a198e642da298a66fc5cb3e9b6e246dbd972b6.zip |
session: Update reason code on disconnect
-rw-r--r-- | src/session.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/session.c b/src/session.c index 07d4ef34..7037cec6 100644 --- a/src/session.c +++ b/src/session.c @@ -756,26 +756,30 @@ static connman_bool_t explicit_disconnect(struct connman_session *session) static void test_and_disconnect(struct connman_session *session) { struct session_info *info = session->info; - struct service_entry *entry; + struct connman_service *service; connman_bool_t disconnect; - disconnect = explicit_disconnect(session); + if (info->entry == NULL) + return; - entry = info->entry; + disconnect = explicit_disconnect(session); info->online = FALSE; info->reason = CONNMAN_SESSION_REASON_UNKNOWN; + info->entry->reason = CONNMAN_SESSION_REASON_UNKNOWN; + + service = info->entry->service; info->entry = NULL; if (disconnect == TRUE) { - DBG("disconnect service %p", entry->service); + DBG("disconnect service %p", service); /* * TODO: We should mark this entry as pending work. In case * disconnect fails we just unassign this session from the * service and can't do anything later on it */ - __connman_service_disconnect(entry->service); + __connman_service_disconnect(service); } } |