Change in libosmo-sccp[master]: sccp_scoc: add user arg to conn_create{, _id}()

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

osmith gerrit-no-reply at lists.osmocom.org
Wed Apr 3 13:15:20 UTC 2019


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/13508


Change subject: sccp_scoc: add user arg to conn_create{,_id}()
......................................................................

sccp_scoc: add user arg to conn_create{,_id}()

Add the argument instead of calling conn_create() and setting
conn->user afterwards. Prepare for generating a local_ref inside
conn_create_id() in the future.

Related: OS#3871
Change-Id: I2fb47c8ba6c0ce7cd92c9ac31f15c67eb67fb66e
---
M src/sccp_scoc.c
1 file changed, 6 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/08/13508/1

diff --git a/src/sccp_scoc.c b/src/sccp_scoc.c
index 82590a0..a916e58 100644
--- a/src/sccp_scoc.c
+++ b/src/sccp_scoc.c
@@ -459,7 +459,7 @@
 #define INIT_TIMER(x, fn, priv)		do { (x)->cb = fn; (x)->data = priv; } while (0)
 
 /* allocate + init a SCCP Connection with given ID */
-static struct sccp_connection *conn_create_id(struct osmo_sccp_instance *inst,
+static struct sccp_connection *conn_create_id(struct osmo_sccp_instance *inst, struct osmo_sccp_user *user,
 					      uint32_t conn_id)
 {
 	struct sccp_connection *conn = talloc_zero(inst, struct sccp_connection);
@@ -490,11 +490,12 @@
 		return NULL;
 	}
 
+	conn->user = user;
 	return conn;
 }
 
 /* Search for next free connection ID and allocate conn */
-static struct sccp_connection *conn_create(struct osmo_sccp_instance *inst)
+static struct sccp_connection *conn_create(struct osmo_sccp_instance *inst, struct osmo_sccp_user *user)
 {
 	uint32_t conn_id;
 
@@ -502,7 +503,7 @@
 		conn_id = inst->next_id++;
 	} while (conn_find_by_id(inst, conn_id));
 
-	return conn_create_id(inst, conn_id);
+	return conn_create_id(inst, user, conn_id);
 }
 
 /* destroy a SCCP connection state, releasing all timers, terminating
@@ -1623,8 +1624,7 @@
 			return;
 		}
 		/* Allocate new connection */
-		conn = conn_create(inst);
-		conn->user = scu;
+		conn = conn_create(inst, scu);
 		conn->incoming = true;
 	} else {
 		uint32_t conn_id;
@@ -1718,14 +1718,13 @@
 		return sccp_sclc_user_sap_down(scu, oph);
 	case OSMO_PRIM(OSMO_SCU_PRIM_N_CONNECT, PRIM_OP_REQUEST):
 		/* Allocate new connection structure */
-		conn = conn_create_id(inst, prim->u.connect.conn_id);
+		conn = conn_create_id(inst, scu, prim->u.connect.conn_id);
 		if (!conn) {
 			/* FIXME: inform SCCP user with proper reply */
 			LOGP(DLSCCP, LOGL_ERROR, "Cannot create conn-id for primitive %s\n",
 			     osmo_scu_prim_name(&prim->oph));
 			goto out;
 		}
-		conn->user = scu;
 		break;
 	case OSMO_PRIM(OSMO_SCU_PRIM_N_CONNECT, PRIM_OP_RESPONSE):
 	case OSMO_PRIM(OSMO_SCU_PRIM_N_DATA, PRIM_OP_REQUEST):

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

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2fb47c8ba6c0ce7cd92c9ac31f15c67eb67fb66e
Gerrit-Change-Number: 13508
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190403/d25d2ad9/attachment.htm>


More information about the gerrit-log mailing list