Change in libosmocore[master]: ns2: refactor handle_nsip_read/handle_nsfrgre_read

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
Fri Sep 25 10:12:42 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/20270 )

Change subject: ns2: refactor handle_nsip_read/handle_nsfrgre_read
......................................................................

ns2: refactor handle_nsip_read/handle_nsfrgre_read

Might be more readable.

Change-Id: Ib2dbcae55a8c7a973cfa1123784f509708de7f3b
---
M src/gb/gprs_ns2_frgre.c
M src/gb/gprs_ns2_udp.c
2 files changed, 6 insertions(+), 12 deletions(-)

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



diff --git a/src/gb/gprs_ns2_frgre.c b/src/gb/gprs_ns2_frgre.c
index 0903e46..e2e0b29 100644
--- a/src/gb/gprs_ns2_frgre.c
+++ b/src/gb/gprs_ns2_frgre.c
@@ -446,12 +446,11 @@
 		rc = ns2_create_vc(bind, msg, "newconnection", &reject, &nsvc);
 		switch (rc) {
 		case GPRS_NS2_CS_FOUND:
-			rc = ns2_recv_vc(nsvc, msg);
 			break;
 		case GPRS_NS2_CS_ERROR:
 		case GPRS_NS2_CS_SKIPPED:
 			rc = 0;
-			break;
+			goto out;
 		case GPRS_NS2_CS_REJECTED:
 			/* nsip_sendmsg will free reject */
 			frgre_sendmsg(bind, reject, &saddr);
@@ -459,13 +458,11 @@
 		case GPRS_NS2_CS_CREATED:
 			frgre_alloc_vc(bind, nsvc, &saddr, dlci);
 			gprs_ns2_vc_fsm_start(nsvc);
-			rc = ns2_recv_vc(nsvc, msg);
 			break;
 		}
-	} else {
-		/* VC found */
-		rc = ns2_recv_vc(nsvc, msg);
 	}
+
+	rc = ns2_recv_vc(nsvc, msg);
 out:
 	msgb_free(msg);
 
diff --git a/src/gb/gprs_ns2_udp.c b/src/gb/gprs_ns2_udp.c
index 2f55f2a..bda0acf 100644
--- a/src/gb/gprs_ns2_udp.c
+++ b/src/gb/gprs_ns2_udp.c
@@ -195,12 +195,11 @@
 		rc = ns2_create_vc(bind, msg, "newconnection", &reject, &nsvc);
 		switch (rc) {
 		case GPRS_NS2_CS_FOUND:
-			rc = ns2_recv_vc(nsvc, msg);
 			break;
 		case GPRS_NS2_CS_ERROR:
 		case GPRS_NS2_CS_SKIPPED:
 			rc = 0;
-			break;
+			goto out;
 		case GPRS_NS2_CS_REJECTED:
 			/* nsip_sendmsg will free reject */
 			nsip_sendmsg(bind, reject, &saddr);
@@ -208,14 +207,12 @@
 		case GPRS_NS2_CS_CREATED:
 			ns2_driver_alloc_vc(bind, nsvc, &saddr);
 			gprs_ns2_vc_fsm_start(nsvc);
-			rc = ns2_recv_vc(nsvc, msg);
 			break;
 		}
-	} else {
-		/* VC found */
-		rc = ns2_recv_vc(nsvc, msg);
 	}
 
+	rc = ns2_recv_vc(nsvc, msg);
+out:
 	msgb_free(msg);
 
 	return rc;

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ib2dbcae55a8c7a973cfa1123784f509708de7f3b
Gerrit-Change-Number: 20270
Gerrit-PatchSet: 3
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann 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/20200925/c2931fdf/attachment.htm>


More information about the gerrit-log mailing list