neels has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-sccp/+/18503 )

Change subject: sccp_user_find: optimize: search PC only for valid PC arg
......................................................................

sccp_user_find: optimize: search PC only for valid PC arg

Though, since in current practice, not many users exist, and all incoming
messages have a valid PC, this is unlikely to have any noticeable effect.

Change-Id: I3533a01e29b97bebe4b8f1f6965444519b3bacfe
---
M src/sccp_user.c
1 file changed, 6 insertions(+), 4 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/sccp_user.c b/src/sccp_user.c
index a36ac93..d8a7357 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -50,10 +50,12 @@
 {
        struct osmo_sccp_user *scu;

-       /* First try to find match for PC + SSN */
-       llist_for_each_entry(scu, &inst->users, list) {
-               if (osmo_ss7_pc_is_valid(scu->pc) && scu->pc == pc && scu->ssn 
== ssn)
-                       return scu;
+       if (osmo_ss7_pc_is_valid(pc)) {
+               /* First try to find match for PC + SSN */
+               llist_for_each_entry(scu, &inst->users, list) {
+                       if (osmo_ss7_pc_is_valid(scu->pc) && scu->pc == pc && 
scu->ssn == ssn)
+                               return scu;
+               }
        }

        /* Then try to match on SSN only */

--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/18503
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I3533a01e29b97bebe4b8f1f6965444519b3bacfe
Gerrit-Change-Number: 18503
Gerrit-PatchSet: 2
Gerrit-Owner: neels <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: neels <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to