ConnMan network manager
 help / color / Atom feed
* [PATCH] service: apply_relevant_default_downgrade cleanup
@ 2021-06-23 13:41 VAUTRIN Emmanuel (Canal Plus Prestataire)
  2021-07-02  7:52 ` Daniel Wagner
  0 siblings, 1 reply; 3+ messages in thread
From: VAUTRIN Emmanuel (Canal Plus Prestataire) @ 2021-06-23 13:41 UTC (permalink / raw)
  To: connman

For uniformity reasons, and to ensure the state coherence, the
apply_relevant_default_downgrade shall rely on downgrade_state generic
function, instead of processing itself the state downgrade.
---
 src/service.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/service.c b/src/service.c
index cb0103fd7221..13f619be7066 100644
--- a/src/service.c
+++ b/src/service.c
@@ -4711,15 +4711,11 @@ static void apply_relevant_default_downgrade(struct connman_service *service)
 	struct connman_service *def_service;
 
 	def_service = connman_service_get_default();
-	if (!def_service)
+	if (!def_service || def_service != service ||
+		def_service->state != CONNMAN_SERVICE_STATE_ONLINE)
 		return;
 
-	if (def_service == service &&
-			def_service->state == CONNMAN_SERVICE_STATE_ONLINE) {
-		def_service->state = CONNMAN_SERVICE_STATE_READY;
-		__connman_notifier_leave_online(def_service->type);
-		state_changed(def_service);
-	}
+	downgrade_state(def_service);
 }
 
 static void switch_default_service(struct connman_service *default_service,
-- 
2.25.1


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

* Re: [PATCH] service: apply_relevant_default_downgrade cleanup
  2021-06-23 13:41 [PATCH] service: apply_relevant_default_downgrade cleanup VAUTRIN Emmanuel (Canal Plus Prestataire)
@ 2021-07-02  7:52 ` Daniel Wagner
  2021-07-02  8:05   ` VAUTRIN Emmanuel (Canal Plus Prestataire)
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Wagner @ 2021-07-02  7:52 UTC (permalink / raw)
  To: VAUTRIN Emmanuel (Canal Plus Prestataire); +Cc: connman

Hi Emmanuel,

On Wed, Jun 23, 2021 at 01:41:35PM +0000, VAUTRIN Emmanuel (Canal Plus Prestataire) wrote:
> For uniformity reasons, and to ensure the state coherence, the
> apply_relevant_default_downgrade shall rely on downgrade_state generic
> function, instead of processing itself the state downgrade.

Patch applied! Nice cleanup.
Daniel

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

* RE: [PATCH] service: apply_relevant_default_downgrade cleanup
  2021-07-02  7:52 ` Daniel Wagner
@ 2021-07-02  8:05   ` VAUTRIN Emmanuel (Canal Plus Prestataire)
  0 siblings, 0 replies; 3+ messages in thread
From: VAUTRIN Emmanuel (Canal Plus Prestataire) @ 2021-07-02  8:05 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: connman

> Patch applied! Nice cleanup.
Great news, thank you Daniel.

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-23 13:41 [PATCH] service: apply_relevant_default_downgrade cleanup VAUTRIN Emmanuel (Canal Plus Prestataire)
2021-07-02  7:52 ` Daniel Wagner
2021-07-02  8:05   ` VAUTRIN Emmanuel (Canal Plus Prestataire)

ConnMan network manager

Archives are clonable:
	git clone --mirror https://lore.kernel.org/connman/0 connman/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 connman connman/ https://lore.kernel.org/connman \
		connman@lists.linux.dev
	public-inbox-index connman

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/dev.linux.lists.connman


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git