diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2020-05-14 16:14:03 +0200 |
---|---|---|
committer | neels <nhofmeyr@sysmocom.de> | 2020-06-15 13:20:47 +0000 |
commit | 3d8605d8685749f662709a861ce579f526924fe0 (patch) | |
tree | 2992b27e92e6adb32401e07797b2ac774636f7ba | |
parent | b0802866746f302f636b707c8eec11fc2d06313c (diff) |
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
-rw-r--r-- | src/sccp_user.c | 10 |
1 files changed, 6 insertions, 4 deletions
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 @@ sccp_user_find(struct osmo_sccp_instance *inst, uint16_t ssn, uint32_t pc) { 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 */ |