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/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/20030 )
Change subject: mgw: Release endpoint after last conn times out
......................................................................
mgw: Release endpoint after last conn times out
Otherwise some state is kept, like the previous CallId, which may then
provoke issues next time the endpoint is to be used.
Change-Id: I3ac4f4542c1c8c877127c64acce6c82b458f697f
---
M include/osmocom/mgcp/mgcp_endp.h
M src/libosmo-mgcp/mgcp_conn.c
M src/libosmo-mgcp/mgcp_endp.c
M src/libosmo-mgcp/mgcp_network.c
4 files changed, 24 insertions(+), 9 deletions(-)
Approvals:
Jenkins Builder: Verified
dexter: Looks good to me, but someone else must approve; Verified
laforge: Looks good to me, approved
diff --git a/include/osmocom/mgcp/mgcp_endp.h b/include/osmocom/mgcp/mgcp_endp.h
index 14cae25..8d19b44 100644
--- a/include/osmocom/mgcp/mgcp_endp.h
+++ b/include/osmocom/mgcp/mgcp_endp.h
@@ -139,3 +139,5 @@
struct mgcp_endpoint *mgcp_endp_by_name(int *cause, const char *epname,
struct mgcp_config *cfg);
bool mgcp_endp_avail(struct mgcp_endpoint *endp);
+void mgcp_endp_add_conn(struct mgcp_endpoint *endp, struct mgcp_conn *conn);
+void mgcp_endp_remove_conn(struct mgcp_endpoint *endp, struct mgcp_conn *conn);
diff --git a/src/libosmo-mgcp/mgcp_conn.c b/src/libosmo-mgcp/mgcp_conn.c
index 328e580..6424dcb 100644
--- a/src/libosmo-mgcp/mgcp_conn.c
+++ b/src/libosmo-mgcp/mgcp_conn.c
@@ -199,7 +199,7 @@
/* Initialize watchdog */
osmo_timer_setup(&conn->watchdog, mgcp_conn_watchdog_cb, conn);
mgcp_conn_watchdog_kick(conn);
- llist_add(&conn->entry, &endp->conns);
+ mgcp_endp_add_conn(endp, conn);
return conn;
}
@@ -289,12 +289,6 @@
if (!conn)
return;
- /* Run endpoint cleanup action. By this we inform the endpoint about
- * the removal of the connection and allow it to clean up its inner
- * state accordingly */
- if (endp->type->cleanup_cb)
- endp->type->cleanup_cb(endp, conn);
-
switch (conn->type) {
case MGCP_CONN_TYPE_RTP:
aggregate_rtp_conn_stats(endp, &conn->u.rtp);
@@ -308,7 +302,8 @@
}
osmo_timer_del(&conn->watchdog);
- llist_del(&conn->entry);
+ mgcp_endp_remove_conn(endp, conn);
+ /* WARN: endp may have be freed after call to mgcp_endp_remove_conn */
talloc_free(conn);
}
diff --git a/src/libosmo-mgcp/mgcp_endp.c b/src/libosmo-mgcp/mgcp_endp.c
index c4f3653..ecb2845 100644
--- a/src/libosmo-mgcp/mgcp_endp.c
+++ b/src/libosmo-mgcp/mgcp_endp.c
@@ -666,3 +666,20 @@
OSMO_ASSERT(false);
}
}
+
+void mgcp_endp_add_conn(struct mgcp_endpoint *endp, struct mgcp_conn *conn)
+{
+ llist_add(&conn->entry, &endp->conns);
+}
+
+void mgcp_endp_remove_conn(struct mgcp_endpoint *endp, struct mgcp_conn *conn)
+{
+ /* Run endpoint cleanup action. By this we inform the endpoint about
+ * the removal of the connection and allow it to clean up its inner
+ * state accordingly */
+ if (endp->type->cleanup_cb)
+ endp->type->cleanup_cb(endp, conn);
+ llist_del(&conn->entry);
+ if (llist_empty(&endp->conns))
+ mgcp_endp_release(endp);
+}
diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index 75a4754..fa40f1f 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -1379,7 +1379,8 @@
* connections present when one connection is removed from the
* endpoint. */
llist_for_each_entry(conn_cleanup, &endp->conns, entry) {
- conn_cleanup->priv = NULL;
+ if (conn_cleanup->priv == conn)
+ conn_cleanup->priv = NULL;
}
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/20030
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I3ac4f4542c1c8c877127c64acce6c82b458f697f
Gerrit-Change-Number: 20030
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
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/20200909/c902a07f/attachment.htm>