osmux: don't store conn ptr inside shared osmux_handle
The struct osmux_handle is a shared structure which goes together 1-1
with libosmo-netif's struct osmux_in_handle, which is common to all CIDs
to be muxed together. Hence, it makes no sense to store a specific conn
object to it, since it actually manages several of them. Hence, all the
conn specific stuff must be handled beforehand, not at osmux deliver
time.
Related: SYS#5987
Change-Id: Ie739b556e9eb7d3133e798831a09728c7cc87135
diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c
index 4d1ec72..51a4b9c 100644
--- a/src/libosmo-mgcp/mgcp_osmux.c
+++ b/src/libosmo-mgcp/mgcp_osmux.c
@@ -36,7 +36,6 @@
struct osmux_handle {
struct llist_head head;
- struct mgcp_conn_rtp *conn;
struct osmux_in_handle *in;
struct osmo_sockaddr rem_addr;
int refcnt;
@@ -48,14 +47,8 @@
static void osmux_deliver_cb(struct msgb *batch_msg, void *data)
{
struct osmux_handle *handle = data;
- struct mgcp_conn_rtp *conn = handle->conn;
socklen_t dest_len;
- if (!conn->end.output_enabled) {
- msgb_free(batch_msg);
- return;
- }
-
switch (handle->rem_addr.u.sa.sa_family) {
case AF_INET6:
dest_len = sizeof(handle->rem_addr.u.sin6);
@@ -130,7 +123,6 @@
h = talloc_zero(osmux, struct osmux_handle);
if (!h)
return NULL;
- h->conn = conn;
h->rem_addr = *rem_addr;
h->refcnt++;
@@ -192,6 +184,9 @@
int ret;
struct msgb *msg;
+ if (!conn->end.output_enabled)
+ return -1;
+
if (conn->osmux.state != OSMUX_STATE_ENABLED) {
LOGPCONN(conn->conn, DOSMUX, LOGL_INFO, "forwarding RTP to Osmux conn not yet enabled, dropping (cid=%d)\n",
conn->osmux.cid);