Change in osmo-remsim[master]: remsim-client: Fix the -k/ --keep-running option

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Dec 17 00:19:36 UTC 2019


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-remsim/+/16623 )


Change subject: remsim-client: Fix the -k/ --keep-running option
......................................................................

remsim-client: Fix the -k/ --keep-running option

When introducing asynchronous USB support in Change-Id
Ic18690b3c2cbc5e99de0665c0b68b7555433b3cd, we accidentially
broke the --keep-running behavior, where even a disappearing USB
device will not terminate the remsim-client process.

Change-Id: I67a3a5941434f09f7099c2cdb19c126cea305a73
---
M src/simtrace2-remsim_client.c
1 file changed, 14 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/23/16623/1

diff --git a/src/simtrace2-remsim_client.c b/src/simtrace2-remsim_client.c
index ac78dd4..1af3274 100644
--- a/src/simtrace2-remsim_client.c
+++ b/src/simtrace2-remsim_client.c
@@ -96,6 +96,9 @@
 void __thread *talloc_asn1_ctx;
 int asn_debug;
 
+/* should we leave main loop processing? */
+bool g_leave_main = false;
+
 __attribute__((unused)) static int gsmtap_send_sim(const uint8_t *apdu, unsigned int len)
 {
 	struct gsmtap_hdr *gh;
@@ -152,10 +155,11 @@
 		break;
 	case LIBUSB_TRANSFER_NO_DEVICE:
 		fprintf(stderr, "USB device disappeared\n");
-		exit(23);
+		g_leave_main = true;
 		break;
 	default:
-		osmo_panic("USB OUT transfer failed, status=%u\n", xfer->status);
+		fprintf(stderr, "USB OUT transfer failed, status=%u\n", xfer->status);
+		g_leave_main = true;
 		break;
 	}
 
@@ -577,10 +581,11 @@
 		break;
 	case LIBUSB_TRANSFER_NO_DEVICE:
 		fprintf(stderr, "USB device disappeared\n");
-		exit(23);
+		g_leave_main = true;
 		break;
 	default:
-		osmo_panic("USB IN transfer failed, status=%u\n", xfer->status);
+		fprintf(stderr, "USB IN transfer failed, status=%u\n", xfer->status);
+		g_leave_main = true;
 		break;
 	}
 
@@ -627,10 +632,11 @@
 		break;
 	case LIBUSB_TRANSFER_NO_DEVICE:
 		fprintf(stderr, "USB device disappeared\n");
-		exit(23);
+		g_leave_main = true;
 		break;
 	default:
-		osmo_panic("USB IRQ transfer failed, status=%u\n", xfer->status);
+		fprintf(stderr, "USB IRQ transfer failed, status=%u\n", xfer->status);
+		g_leave_main = true;
 		break;
 	}
 
@@ -1092,9 +1098,10 @@
 	allocate_and_submit_irq(ci);
 	allocate_and_submit_in(ci);
 
-	while (1) {
+	while (!g_leave_main) {
 		osmo_select_main(false);
 	}
+	g_leave_main = false;
 
 	libusb_release_interface(transp->usb_devh, 0);
 

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

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I67a3a5941434f09f7099c2cdb19c126cea305a73
Gerrit-Change-Number: 16623
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191217/5c923247/attachment.htm>


More information about the gerrit-log mailing list