<p>Sean Bright has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/18010">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_logger.c: Don't blindly disable logging on res_pjsip reload.<br><br>When res_pjsip is reloaded, the logger module will look at the 'debug'<br>option under a type=global PJSIP section and react<br>appropriately. Unfortunately, because 'debug' defaults to 'no',<br>issuing a reload will disable all logging even if you haven't<br>explicitly asked for it to be disabled.<br><br>Now we check that the value of the 'debug' option has changed between<br>reload invocations and only react when it has.<br><br>ASTERISK-29912 #close<br><br>Change-Id: I3c9e6f39da65a625d8295178b526ed2cce4be115<br>---<br>M res/res_pjsip_logger.c<br>1 file changed, 15 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/10/18010/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip_logger.c b/res/res_pjsip_logger.c</span><br><span>index 957020f..6286fb0 100644</span><br><span>--- a/res/res_pjsip_logger.c</span><br><span>+++ b/res/res_pjsip_logger.c</span><br><span>@@ -120,6 +120,9 @@</span><br><span> /*! \brief The default logger session */</span><br><span> static struct pjsip_logger_session *default_logger;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/*! \brief The cached value of the global 'debug' option */</span><br><span style="color: hsl(120, 100%, 40%);">+static char *global_debug_state;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*! \brief Destructor for logger session */</span><br><span> static void pjsip_logger_session_destroy(void *obj)</span><br><span> {</span><br><span>@@ -513,7 +516,16 @@</span><br><span> </span><br><span> static void check_debug(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- RAII_VAR(char *, debug, ast_sip_get_debug(), ast_free);</span><br><span style="color: hsl(120, 100%, 40%);">+       char *debug = ast_sip_get_debug();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  if (global_debug_state && !strcmp(global_debug_state, debug)) {</span><br><span style="color: hsl(120, 100%, 40%);">+               /* The 'debug' setting hasn't changed, so bail early */</span><br><span style="color: hsl(120, 100%, 40%);">+           ast_free(debug);</span><br><span style="color: hsl(120, 100%, 40%);">+              return;</span><br><span style="color: hsl(120, 100%, 40%);">+       }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   ast_free(global_debug_state);</span><br><span style="color: hsl(120, 100%, 40%);">+ global_debug_state = debug;</span><br><span> </span><br><span>      if (ast_false(debug)) {</span><br><span>              pjsip_disable_logger(-1);</span><br><span>@@ -574,6 +586,8 @@</span><br><span>      ao2_cleanup(default_logger);</span><br><span>         default_logger = NULL;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+    ast_free(global_debug_state);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>      return 0;</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/18010">change 18010</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/18010"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I3c9e6f39da65a625d8295178b526ed2cce4be115 </div>
<div style="display:none"> Gerrit-Change-Number: 18010 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean@seanbright.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>