From e31ffc9891361640ea78e1abe16894daf247b337 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Mon, 26 Apr 2021 11:17:34 +0300 Subject: sim-auth: Only close open sessions Session has to be open in order to have a valid session_id --- src/sim.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/sim.c b/src/sim.c index e150c962..4a05ac32 100644 --- a/src/sim.c +++ b/src/sim.c @@ -3805,7 +3805,8 @@ void __ofono_sim_remove_session_watch(struct ofono_sim_aid_session *session, { __ofono_watchlist_remove_item(session->watches, id); - if (g_slist_length(session->watches->items) == 0) { + if (g_slist_length(session->watches->items) == 0 && + session->state == SESSION_STATE_OPEN) { /* last watcher, close session */ session->state = SESSION_STATE_CLOSING; session->sim->driver->close_channel(session->sim, -- cgit v1.2.1