-
Notifications
You must be signed in to change notification settings - Fork 813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Share an auth session between multiple dialogs/regc #4262
base: master
Are you sure you want to change the base?
Conversation
To reduce the network load in scenarios where multiple SUBSCRIBE dialogs are used, one can enable PJSIP_SHARED_AUTH_SESSION to allow setting a pjsip_auth_clt_sess for the dialogs. This session will then be in charge of handling all auth requests.
when PJSIP_SHARED_AUTH_SESSION is enabled, the account will try to reuse authorization headers.
pjsip/src/pjsip/sip_auth_client.c
Outdated
return NULL; | ||
} | ||
if (sess->parent) { | ||
pauth = sess->parent->cached_auth.next; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No iteration to lookup the matched realm
& algorithm_type
on parent?
(Or perhaps recursive call to self like in auth_find_cred()
)
I like the feature and I prefer a runtime option in But don't do any modifications yet, let's hear first what others think about this. |
Sounds like a good idea! |
yeah, that sounds good. I wasn't sure if that feature should be available without compile option, so i used a conservative approach |
is there something i need to do regarding the failed checks? |
I'm currently working on the fix on #4263. |
You can merge the master branch to fix the failed tests. |
i just wanted to switch to an config parameter. Is it safe to call pjsip_auth_ctl_deinit in acc_modify, since it releases a pool, that it did not create itself? |
I don't understand the purpose of doing so, but I don't think you should call |
* use lock of parent instead of lock child lock. * recusively call parent in auth_find_cred
Instead of an compile time option to share the authorization headers, the pjsua acc can be configured to reuse the headers.
Generally looks okay to me, perhaps a few touch-ups may improve it a bit, for example:
If you want, we can do the above directly in the PR branch. |
* improved comments * line width * create lock only in parent * removed lock/unlock status tests
in pjsua2 it is now called useSharedAuth also: improved some comments
The CI tests, despite being restarted several times, seem to consistently fail at the same test. Not sure if this is caused by this change, though |
merged the master again, maybe that fixes something? |
For Accounts that establish a lot of dialogs it may be beneficial to reuse a already established Authorization.
To achieve this, the account was extended to store a shared pjsip_auth_clt_sess and this is set on the relevant dialogs.
This patch adds PJSIP_SHARED_AUTH_SESSION to enable this behavior in the account and to extend the relevant api.