Change in osmo-msc[master]: osmo-msc main: use osmo_select_shutdown()

laforge gerrit-no-reply at lists.osmocom.org
Fri Jun 25 08:11:57 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/24753 )

Change subject: osmo-msc main: use osmo_select_shutdown()
......................................................................

osmo-msc main: use osmo_select_shutdown()

Change-Id: I75f4637c051ed44628e65dab1bdbbf28dcc9626f
---
M src/osmo-msc/msc_main.c
1 file changed, 15 insertions(+), 5 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, but someone else must approve
  dexter: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c
index fcca101..a0f584d 100644
--- a/src/osmo-msc/msc_main.c
+++ b/src/osmo-msc/msc_main.c
@@ -776,14 +776,24 @@
 		}
 	}
 
-	while (!quit) {
+	do {
 		log_reset_context();
 		osmo_select_main_ctx(0);
-	}
 
-	msc_network_shutdown(msc_network);
-	osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
-	sleep(3);
+		/* If the user hits Ctrl-C the third time, just terminate immediately. */
+		if (quit >= 3)
+			break;
+
+		/* Has SIGTERM been received (and not yet been handled)? */
+		if (quit && !osmo_select_shutdown_requested()) {
+			msc_network_shutdown(msc_network);
+			osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
+
+			/* Request write-only mode in osmo_select_main_ctx() */
+			osmo_select_shutdown_request();
+			/* continue the main select loop until all write queues are serviced. */
+		}
+	} while (!osmo_select_shutdown_done());
 
 	log_fini();
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/24753
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I75f4637c051ed44628e65dab1bdbbf28dcc9626f
Gerrit-Change-Number: 24753
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210625/5a11a6bc/attachment.htm>


More information about the gerrit-log mailing list