osmux: Move setting OSMUX_STATE_DISABLED to initializer function
Change-Id: I7c184b17075fc3e71f1f66775e16b56a5ae91b62
diff --git a/src/libosmo-mgcp/mgcp_conn.c b/src/libosmo-mgcp/mgcp_conn.c
index 08c9301..c74069d 100644
--- a/src/libosmo-mgcp/mgcp_conn.c
+++ b/src/libosmo-mgcp/mgcp_conn.c
@@ -95,6 +95,9 @@
static atomic_uint rate_ctr_index = 0;
conn_rtp->type = MGCP_RTP_DEFAULT;
+
+ /* Osmux specific defaults, only used if conn is later on Osmux-enabled: */
+ conn_rtp->osmux.state = OSMUX_STATE_DISABLED;
conn_rtp->osmux.local_cid_allocated = false;
conn_rtp->osmux.local_cid = 0;
conn_rtp->osmux.remote_cid_present = false;
diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c
index 473e655..8ffdf31 100644
--- a/src/libosmo-mgcp/mgcp_osmux.c
+++ b/src/libosmo-mgcp/mgcp_osmux.c
@@ -524,6 +524,8 @@
conn->osmux.ctrg = rate_ctr_group_alloc(conn->conn, &rate_ctr_group_osmux_desc, conn->ctrg->idx);
conn->type = MGCP_RTP_OSMUX;
+ /* Annotate Osmux circuit ID and set it to negotiating state until this
+ * is fully set up from the dummy load. */
conn->osmux.state = OSMUX_STATE_ACTIVATING;
return 0;
}
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index d92725a..fdac665 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -1003,9 +1003,6 @@
goto error2;
}
- /* Annotate Osmux circuit ID and set it to negotiating state until this
- * is fully set up from the dummy load. */
- conn->osmux.state = OSMUX_STATE_DISABLED;
/* If X-Osmux (remote CID) was received (-1 is wilcard), alloc next avail CID as local CID */
if (remote_osmux_cid >= -1) {
if (osmux_init_conn(conn) < 0) {