[Asterisk-code-review] res_pjsip: Always set async_operations to 1. (asterisk[16])

Friendly Automation asteriskteam at digium.com
Tue Apr 26 11:10:30 CDT 2022


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/18365 )

Change subject: res_pjsip: Always set async_operations to 1.
......................................................................

res_pjsip: Always set async_operations to 1.

The async_operations setting on a transport configures how
many simultaneous incoming packets the transport can handle
when multiple threads are polling and waiting on the transport.
As we only use a single thread this was needlessly creating
incoming packets when set to a non-default value, wasting memory.

ASTERISK-30006

Change-Id: I1915973ef352862dc2852a6ba4cfce2ed536e68f
---
M configs/samples/pjsip.conf.sample
A doc/UPGRADE-staging/res_pjsip_async_operations.txt
M res/res_pjsip/config_transport.c
M res/res_pjsip/pjsip_config.xml
4 files changed, 14 insertions(+), 3 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/configs/samples/pjsip.conf.sample b/configs/samples/pjsip.conf.sample
index 33a2ce0..d5bf8d5 100644
--- a/configs/samples/pjsip.conf.sample
+++ b/configs/samples/pjsip.conf.sample
@@ -972,8 +972,6 @@
 ;[transport]
 ;  SYNOPSIS: SIP Transport
 ;
-;async_operations=1     ; Number of simultaneous Asynchronous Operations
-                        ; (default: "1")
 ;bind=  ; IP Address and optional port to bind to for this transport (default:
         ; "")
 ; Note that for the Websocket transport the TLS configuration is configured
diff --git a/doc/UPGRADE-staging/res_pjsip_async_operations.txt b/doc/UPGRADE-staging/res_pjsip_async_operations.txt
new file mode 100644
index 0000000..cf9f942
--- /dev/null
+++ b/doc/UPGRADE-staging/res_pjsip_async_operations.txt
@@ -0,0 +1,7 @@
+Subject: res_pjsip
+
+The 'async_operations' setting on transports is no longer
+obeyed and instead is always set to 1. This is due to the
+functionality not being applicable to Asterisk and causing
+excess unnecessary memory usage. This setting will now be
+ignored but can also be removed from the configuration file.
diff --git a/res/res_pjsip/config_transport.c b/res/res_pjsip/config_transport.c
index c596b79..4bc6f6e 100644
--- a/res/res_pjsip/config_transport.c
+++ b/res/res_pjsip/config_transport.c
@@ -489,6 +489,12 @@
 		return -1;
 	}
 
+	if (transport->async_operations != 1) {
+		ast_log(LOG_WARNING, "The async_operations setting on transport '%s' has been set to '%d'. The setting can no longer be set and is always 1.\n",
+			transport_id, transport->async_operations);
+		transport->async_operations = 1;
+	}
+
 	perm_state = find_internal_state_by_transport(transport);
 	if (perm_state) {
 		ast_sorcery_diff(sorcery, perm_state->transport, transport, &changes);
diff --git a/res/res_pjsip/pjsip_config.xml b/res/res_pjsip/pjsip_config.xml
index 52139b0..5a1b2b6 100644
--- a/res/res_pjsip/pjsip_config.xml
+++ b/res/res_pjsip/pjsip_config.xml
@@ -1305,7 +1305,7 @@
 						will not suffice.</para></note>
 				</description>
 				<configOption name="async_operations" default="1">
-					<synopsis>Number of simultaneous Asynchronous Operations</synopsis>
+					<synopsis>Number of simultaneous Asynchronous Operations, can no longer be set, always set to 1</synopsis>
 				</configOption>
 				<configOption name="bind">
 					<synopsis>IP Address and optional port to bind to for this transport</synopsis>

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18365
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I1915973ef352862dc2852a6ba4cfce2ed536e68f
Gerrit-Change-Number: 18365
Gerrit-PatchSet: 3
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220426/40fe8c19/attachment.html>


More information about the asterisk-code-review mailing list