[PATCH] osmo-mgw[master]: mgcp_conn: add function mgcp_rtp_conn_cleanup()

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

dexter gerrit-no-reply at lists.osmocom.org
Mon Mar 19 17:16:09 UTC 2018


Review at  https://gerrit.osmocom.org/7395

mgcp_conn: add function mgcp_rtp_conn_cleanup()

The function mgcp_conn_free() holds a few lines to de-initalize
members which are struct mgcp_conn_rtp specific. Since we already
have an mgcp_rtp_conn_init() that does the intialization, we should
have an mgcp_rtp_conn_cleanup() too.

 - add function mgcp_rtp_conn_cleanup() and move rtp specific
   code to that function.

Change-Id: Ib9bf6d2a3af4f1df1a4ab5ec789b39a2cee2532f
---
M src/libosmo-mgcp/mgcp_conn.c
1 file changed, 9 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/95/7395/1

diff --git a/src/libosmo-mgcp/mgcp_conn.c b/src/libosmo-mgcp/mgcp_conn.c
index 2f691f0..998dbc5 100644
--- a/src/libosmo-mgcp/mgcp_conn.c
+++ b/src/libosmo-mgcp/mgcp_conn.c
@@ -110,6 +110,14 @@
 	mgcp_rtp_codec_init(&end->alt_codec);
 }
 
+/* Cleanup rtp connection struct */
+static void mgcp_rtp_conn_cleanup(struct mgcp_conn_rtp *conn_rtp)
+{
+	osmux_disable_conn(conn_rtp);
+	osmux_release_cid(conn_rtp);
+	mgcp_free_rtp_port(&conn_rtp->end);
+}
+
 /*! allocate a new connection list entry.
  *  \param[in] ctx talloc context
  *  \param[in] endp associated endpoint
@@ -211,9 +219,7 @@
 
 	switch (conn->type) {
 	case MGCP_CONN_TYPE_RTP:
-		osmux_disable_conn(&conn->u.rtp);
-		osmux_release_cid(&conn->u.rtp);
-		mgcp_free_rtp_port(&conn->u.rtp.end);
+		mgcp_rtp_conn_cleanup(&conn->u.rtp);
 		break;
 	default:
 		/* NOTE: This should never be called with an

-- 
To view, visit https://gerrit.osmocom.org/7395
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib9bf6d2a3af4f1df1a4ab5ec789b39a2cee2532f
Gerrit-PatchSet: 1
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>



More information about the gerrit-log mailing list