pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/39208?usp=email )


Change subject: mgw: Avoid 2nd lookup of conn in endp during CRCX
......................................................................

mgw: Avoid 2nd lookup of conn in endp during CRCX

There's no need to lookup (iterate over conns) for rtp_conn in endp, we
have it accessible in constant time.

While at it, simplify some accesses to the pointer after it.

Change-Id: I8316e76a1789d4a8eaa1eb89bdaf86e25dc0a1e8
---
M src/libosmo-mgcp/mgcp_protocol.c
1 file changed, 4 insertions(+), 4 deletions(-)



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

diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 4e63e4d..6d315ca 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -1022,10 +1022,10 @@
                goto error2;
        }

-       conn = mgcp_endp_get_conn_rtp(endp, _conn->id);
+       conn = mgcp_conn_get_conn_rtp(_conn);
        OSMO_ASSERT(conn);

-       if (mgcp_parse_conn_mode(mode, endp, conn->conn) != 0) {
+       if (mgcp_parse_conn_mode(mode, endp, _conn) != 0) {
                error_code = 517;
                rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, 
MGCP_CRCX_FAIL_INVALID_MODE));
                goto error2;
@@ -1108,12 +1108,12 @@
                }
        }

-       LOGPCONN(conn->conn, DLMGCP, LOGL_DEBUG,
+       LOGPCONN(_conn, DLMGCP, LOGL_DEBUG,
                 "CRCX: Creating connection: port: %u\n", conn->end.local_port);

        /* Send dummy packet, see also comments in mgcp_keepalive_timer_cb() */
        OSMO_ASSERT(trunk->keepalive_interval >= MGCP_KEEPALIVE_ONCE);
-       if (conn->conn->mode & MGCP_CONN_RECV_ONLY &&
+       if (_conn->mode & MGCP_CONN_RECV_ONLY &&
            trunk->keepalive_interval != MGCP_KEEPALIVE_NEVER)
                send_dummy(endp, conn);


--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/39208?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I8316e76a1789d4a8eaa1eb89bdaf86e25dc0a1e8
Gerrit-Change-Number: 39208
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to