Skip to contentSkip to conversation

sim-auth: Remove watch if open_channel fails

PATCH In review Slava Monich 2 participants 3 messages Apr 26, 2021 – Apr 30, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 sim-auth: Remove watch if open_channel fails

Otherwise open_channel won't be called again after a failure.

---
 src/sim-auth.c | 2 ++
 1 file changed, 2 insertions(+)
src/sim-auth.c +2 -0
index 0e13b533..3c3f35e7 100644
@@ -367,6 +367,8 @@ static void get_session_cb(ofono_bool_t active, int session_id,
 error:
 	__ofono_dbus_pending_reply(&sa->pending->msg,
 			__ofono_error_failed(sa->pending->msg));
+	__ofono_sim_remove_session_watch(sa->pending->session,
+			sa->pending->watch_id);
 	g_free(sa->pending);
 	sa->pending = NULL;
 }
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 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(-)
src/sim.c +2 -1
index 793ff64a..3319ecee 100644
@@ -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,
Signature · 1 line
2.25.1
#2 lore raw
In reply to Slava Monich

Hi Slava,

Quoted 5 lines · Slava Monich

Otherwise open_channel won't be called again after a failure.

---
  src/sim-auth.c | 2 ++
  1 file changed, 2 insertions(+)

Both applied, thanks.

Regards,
-Denis