pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/39756?usp=email )
Change subject: mgw: Rearrange last steps of CRCX and MDCX ......................................................................
mgw: Rearrange last steps of CRCX and MDCX
Make code in CRCX and MDCX look closer, since it is really doing the same. Move the dummy ping code after everything has been done correctly, since the ping is just a side effect of the conn being created.
Change-Id: I42acda16cb2d59a9b7aae06b7584d4dfc1e91f9e --- M src/libosmo-mgcp/mgcp_protocol.c 1 file changed, 10 insertions(+), 15 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/56/39756/1
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c index 7c1a715..e4386b2 100644 --- a/src/libosmo-mgcp/mgcp_protocol.c +++ b/src/libosmo-mgcp/mgcp_protocol.c @@ -782,8 +782,11 @@ } }
- LOGPCONN(conn, DLMGCP, LOGL_DEBUG, - "CRCX: Creating connection: port: %u\n", conn_rtp->end.local_port); + mgcp_endp_update(endp); + + LOGPCONN(conn, DLMGCP, LOGL_NOTICE, + "CRCX: connection successfully created: %s\n", mgcp_conn_dump(conn)); + rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_CRCX_SUCCESS));
/* Send dummy packet, see also comments in mgcp_keepalive_timer_cb() */ OSMO_ASSERT(trunk->keepalive_interval >= MGCP_KEEPALIVE_ONCE); @@ -791,11 +794,6 @@ trunk->keepalive_interval != MGCP_KEEPALIVE_NEVER) send_dummy(endp, conn_rtp);
- LOGPCONN(conn, DLMGCP, LOGL_NOTICE, - "CRCX: connection successfully created\n"); - rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_CRCX_SUCCESS)); - mgcp_endp_update(endp); - /* NOTE: Only in the virtual trunk we allow dynamic endpoint names */ bool add_epname = rq->wildcarded && trunk->trunk_type == MGCP_TRUNK_VIRTUAL; return create_response_with_sdp(endp, conn_rtp, "CRCX", pdata->trans, add_epname, true); @@ -1006,9 +1004,11 @@ } }
- /* modify */ - LOGPCONN(conn, DLMGCP, LOGL_DEBUG, - "MDCX: modified conn:%s\n", mgcp_conn_dump(conn)); + mgcp_endp_update(endp); + + LOGPCONN(conn, DLMGCP, LOGL_NOTICE, + "MDCX: connection successfully modified: %s\n", mgcp_conn_dump(conn)); + rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_MDCX_SUCCESS));
/* Send dummy packet, see also comments in mgcp_keepalive_timer_cb() */ OSMO_ASSERT(trunk->keepalive_interval >= MGCP_KEEPALIVE_ONCE); @@ -1016,11 +1016,6 @@ trunk->keepalive_interval != MGCP_KEEPALIVE_NEVER) send_dummy(endp, conn_rtp);
- rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_MDCX_SUCCESS)); - - LOGPCONN(conn, DLMGCP, LOGL_NOTICE, - "MDCX: connection successfully modified\n"); - mgcp_endp_update(endp); return create_response_with_sdp(endp, conn_rtp, "MDCX", pdata->trans, false, false); error3: return create_err_response(endp, endp, error_code, "MDCX", pdata->trans);