diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2011-09-20 17:05:32 +0200 |
---|---|---|
committer | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2011-09-22 15:45:50 +0200 |
commit | eb3b4bfdf3592d4f7d5236fe3ad96896e9bad47d (patch) | |
tree | a411337908c6acdbff2e15032c6d573066832dc1 /src/session.c | |
parent | 1d234b13539c4fe5dc51e3f89ca3ab1ced41f720 (diff) | |
download | connman-eb3b4bfdf3592d4f7d5236fe3ad96896e9bad47d.tar.gz connman-eb3b4bfdf3592d4f7d5236fe3ad96896e9bad47d.tar.bz2 connman-eb3b4bfdf3592d4f7d5236fe3ad96896e9bad47d.zip |
session: Simplefy session_changed()
Since we are tracking the reason code now also in
the deslect_and_disconnect() function we can rely
on the correct handling there. Also no need to parse the
reason code again.
Diffstat (limited to 'src/session.c')
-rw-r--r-- | src/session.c | 42 |
1 files changed, 6 insertions, 36 deletions
diff --git a/src/session.c b/src/session.c index 7066eb05..f7980561 100644 --- a/src/session.c +++ b/src/session.c @@ -972,43 +972,13 @@ static void session_changed(struct connman_session *session, break; } - switch (info->reason) { - case CONNMAN_SESSION_REASON_CONNECT: - /* - * We are not online, we are not connecting, that - * means we could still have a valid info->entry. - * Though something has changed from the service layer. - * Therefore we want to restart the algorithm. Before we - * can do that we have to cleanup a potientional old entry. - */ - deselect_and_disconnect(session, - CONNMAN_SESSION_REASON_CONNECT); - - DBG("Retry to find a matching session"); - /* - * The user called Connect() but there was no - * matching session available at this point. - * Now there might be a new one. Let's retry - * to select and connect - */ - select_and_connect(session, - CONNMAN_SESSION_REASON_CONNECT); - break; - case CONNMAN_SESSION_REASON_PERIODIC: - case CONNMAN_SESSION_REASON_FREE_RIDE: - if (info->stay_connected == TRUE) { - DBG("StayConnected"); - select_and_connect(session, - CONNMAN_SESSION_REASON_CONNECT); - } else { - select_and_connect(session, - CONNMAN_SESSION_REASON_FREE_RIDE); - } - break; - case CONNMAN_SESSION_REASON_DISCONNECT: - case CONNMAN_SESSION_REASON_UNKNOWN: - break; + deselect_and_disconnect(session, info->reason); + + if (info->reason == CONNMAN_SESSION_REASON_FREE_RIDE || + info->stay_connected == TRUE) { + select_and_connect(session, info->reason); } + break; case CONNMAN_SESSION_TRIGGER_ECALL: if (info->online == FALSE && info->entry != NULL && |