Change in libosmocore[master]: gprs_ns2_fr: reduce duplication between gprs_ns2_fr_connect / connect2

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
Sun Jan 17 19:27:44 UTC 2021


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/22259 )


Change subject: gprs_ns2_fr: reduce duplication between gprs_ns2_fr_connect / connect2
......................................................................

gprs_ns2_fr: reduce duplication between gprs_ns2_fr_connect / connect2

gprs_sn2_fr_connect2() is the same as gprs_ns2_fr_connect() with
the lookup-and-create-on-demand of the NSE first.

Rather than copy+paste, they should simply invoke each other.

Change-Id: If835bf138f213e7f58205018e7efe3ecb772c624
---
M src/gb/gprs_ns2_fr.c
1 file changed, 1 insertion(+), 18 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/59/22259/1

diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index 2c797f3..bb55381 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -776,7 +776,6 @@
 {
 	bool created_nse = false;
 	struct gprs_ns2_vc *nsvc = NULL;
-	struct priv_vc *priv = NULL;
 	struct gprs_ns2_nse *nse = gprs_ns2_nse_by_nsei(bind->nsi, nsei);
 	if (!nse) {
 		nse = gprs_ns2_create_nse(bind->nsi, nsei, GPRS_NS2_LL_FR, NS2_DIALECT_STATIC_RESETBLOCK);
@@ -785,28 +784,12 @@
 		created_nse = true;
 	}
 
-	nsvc = gprs_ns2_fr_nsvc_by_dlci(bind, dlci);
-	if (nsvc) {
-		goto err_nse;
-	}
-
-	nsvc = ns2_vc_alloc(bind, nse, true, NS2_VC_MODE_BLOCKRESET);
+	nsvc = gprs_ns2_fr_connect(bind, nse, nsvci, dlci);
 	if (!nsvc)
 		goto err_nse;
 
-	nsvc->priv = priv = fr_alloc_vc(bind, nsvc, dlci);
-	if (!priv)
-		goto err;
-
-	nsvc->nsvci = nsvci;
-	nsvc->nsvci_is_valid = true;
-
-	gprs_ns2_vc_fsm_start(nsvc);
-
 	return nsvc;
 
-err:
-	gprs_ns2_free_nsvc(nsvc);
 err_nse:
 	if (created_nse)
 		gprs_ns2_free_nse(nse);

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If835bf138f213e7f58205018e7efe3ecb772c624
Gerrit-Change-Number: 22259
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/20210117/489d29b4/attachment.htm>


More information about the gerrit-log mailing list