Skip to content
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

Add socket option params to transport config in PJSUA2 #4071

Merged
merged 9 commits into from
Sep 13, 2024
Merged

Conversation

sauwming
Copy link
Member

@sauwming sauwming commented Sep 12, 2024

Continuing #3424.

There are a couple of complications with socket options in PJSUA2 level:

  • The option value is passed by address.
  • The option value itself must be available throughout the lifetime of the transport.

So instead, adopting a similar approach as Android API:
https://developer.android.com/reference/android/system/Os#setsockoptInt(java.io.FileDescriptor,%20int,%20int,%20int)
here we pass the option value by setting the integer value. Currently, only integer option value is supported, but this can be extensible to other types, such as timeval.

In addition, we also add API pj_sockopt_params_clone() to perform deep clone of the socket options, so app doesn't need to maintain the buffer.

@sauwming sauwming marked this pull request as ready for review September 12, 2024 05:44
@nanangizz
Copy link
Member

If the lifetime requirement is because the setting is shallow-cloned by transport listener (to be applied to transport instances), perhaps change it to deep-clone to avoid the lifetime requirement? This sounds more like a PJSIP transport issue though.

pjlib/include/pj/sock.h Outdated Show resolved Hide resolved
pjsip/src/pjsip/sip_transport_tcp.c Outdated Show resolved Hide resolved
@sauwming sauwming merged commit 3c3eef9 into master Sep 13, 2024
36 checks passed
@sauwming sauwming deleted the sockoptparams branch September 13, 2024 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants