ofono.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] sim-auth: Remove watch if open_channel fails
@ 2021-04-26  8:17 Slava Monich
  2021-04-26  8:17 ` [PATCH 2/2] sim-auth: Only close open sessions Slava Monich
  2021-04-30 14:31 ` [PATCH 1/2] sim-auth: Remove watch if open_channel fails Denis Kenzior
  0 siblings, 2 replies; 3+ messages in thread
From: Slava Monich @ 2021-04-26  8:17 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 591 bytes --]

Otherwise open_channel won't be called again after a failure.
---
 src/sim-auth.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/sim-auth.c b/src/sim-auth.c
index 0e13b533..3c3f35e7 100644
--- a/src/sim-auth.c
+++ b/src/sim-auth.c
@@ -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;
 }
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] sim-auth: Only close open sessions
  2021-04-26  8:17 [PATCH 1/2] sim-auth: Remove watch if open_channel fails Slava Monich
@ 2021-04-26  8:17 ` Slava Monich
  2021-04-30 14:31 ` [PATCH 1/2] sim-auth: Remove watch if open_channel fails Denis Kenzior
  1 sibling, 0 replies; 3+ messages in thread
From: Slava Monich @ 2021-04-26  8:17 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 706 bytes --]

Session has to be open in order to have a valid session_id
---
 src/sim.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/sim.c b/src/sim.c
index 793ff64a..3319ecee 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,
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] sim-auth: Remove watch if open_channel fails
  2021-04-26  8:17 [PATCH 1/2] sim-auth: Remove watch if open_channel fails Slava Monich
  2021-04-26  8:17 ` [PATCH 2/2] sim-auth: Only close open sessions Slava Monich
@ 2021-04-30 14:31 ` Denis Kenzior
  1 sibling, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2021-04-30 14:31 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 239 bytes --]

Hi Slava,

On 4/26/21 3:17 AM, Slava Monich wrote:
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-30 14:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-26  8:17 [PATCH 1/2] sim-auth: Remove watch if open_channel fails Slava Monich
2021-04-26  8:17 ` [PATCH 2/2] sim-auth: Only close open sessions Slava Monich
2021-04-30 14:31 ` [PATCH 1/2] sim-auth: Remove watch if open_channel fails Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).