Change in libosmocore[master]: gprs_ns2: move allocation of the SNS fsm into create_nse

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/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Tue Dec 15 11:46:46 UTC 2020


lynxis lazus has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/21571 )

Change subject: gprs_ns2: move allocation of the SNS fsm into create_nse
......................................................................

gprs_ns2: move allocation of the SNS fsm into create_nse

The allocation of the SNS fsm can be done in create_nse
because the dialect is now known at that time.

Change-Id: I64e1f3dcc63d38e65bb486c9ac08d4032b7ad222
---
M src/gb/gprs_ns2.c
1 file changed, 13 insertions(+), 6 deletions(-)

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



diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 920fa68..890b656 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -677,6 +677,7 @@
 					 enum gprs_ns2_ll linklayer, enum gprs_ns2_dialect dialect)
 {
 	struct gprs_ns2_nse *nse;
+	char sns[16];
 
 	nse = gprs_ns2_nse_by_nsei(nsi, nsei);
 	if (nse) {
@@ -688,6 +689,15 @@
 	if (!nse)
 		return NULL;
 
+	if (dialect == NS2_DIALECT_SNS) {
+		snprintf(sns, sizeof(sns), "NSE%05u-SNS", nsei);
+		nse->bss_sns_fi = ns2_sns_bss_fsm_alloc(nse, sns);
+		if (!nse->bss_sns_fi) {
+			talloc_free(nse);
+			return NULL;
+		}
+	}
+
 	nse->dialect = dialect;
 	nse->ll = linklayer;
 	nse->nsei = nsei;
@@ -959,14 +969,11 @@
 		return -2;
 	}
 
-	nsvc = gprs_ns2_ip_bind_connect(bind, nse, remote);
-	if (!nsvc)
+	if (!nse->bss_sns_fi)
 		return -1;
 
-	if (!nse->bss_sns_fi)
-		nse->bss_sns_fi = ns2_sns_bss_fsm_alloc(nse, NULL);
-
-	if (!nse->bss_sns_fi)
+	nsvc = gprs_ns2_ip_bind_connect(bind, nse, remote);
+	if (!nsvc)
 		return -1;
 
 	return ns2_sns_bss_fsm_start(nse, nsvc, remote);

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I64e1f3dcc63d38e65bb486c9ac08d4032b7ad222
Gerrit-Change-Number: 21571
Gerrit-PatchSet: 8
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-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201215/c03e4f3c/attachment.htm>


More information about the gerrit-log mailing list