<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10614">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">core: Ensure that el_end is always run when needed.<br><br>* Ignore {{console=yes}} configuration option in remote console<br> processes.<br>* Use new flag to tell consolethread to run el_end and exit when needed.<br><br>ASTERISK-28158<br><br>Change-Id: I9e23b31d4211417ddc88c6bbfd83ea4c9f3e5438<br>---<br>M main/asterisk.c<br>M main/options.c<br>2 files changed, 17 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/14/10614/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/asterisk.c b/main/asterisk.c</span><br><span>index 3354724..12e6255 100644</span><br><span>--- a/main/asterisk.c</span><br><span>+++ b/main/asterisk.c</span><br><span>@@ -389,6 +389,7 @@</span><br><span> unsigned int need_reload:1;</span><br><span> unsigned int need_quit:1;</span><br><span> unsigned int need_quit_handler:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int need_el_end:1;</span><br><span> } sig_flags;</span><br><span> </span><br><span> #if !defined(LOW_MEMORY)</span><br><span>@@ -2015,10 +2016,9 @@</span><br><span> if (el_hist != NULL) {</span><br><span> history_end(el_hist);</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (mon_sig_flags == pthread_self()) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (consolethread != AST_PTHREADT_NULL) {</span><br><span style="color: hsl(0, 100%, 40%);">- pthread_kill(consolethread, SIGURG);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ sig_flags.need_el_end = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ pthread_kill(consolethread, SIGURG);</span><br><span> }</span><br><span> }</span><br><span> active_channels = ast_active_channels();</span><br><span>@@ -2635,7 +2635,7 @@</span><br><span> }</span><br><span> res = ast_poll(fds, max, -1);</span><br><span> if (res < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (sig_flags.need_quit || sig_flags.need_quit_handler) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (sig_flags.need_quit || sig_flags.need_quit_handler || sig_flags.need_el_end) {</span><br><span> break;</span><br><span> }</span><br><span> if (errno == EINTR) {</span><br><span>@@ -3163,7 +3163,7 @@</span><br><span> sprintf(tmp, "%s%s", prefix, data);</span><br><span> if (write(ast_consock, tmp, strlen(tmp) + 1) < 0) {</span><br><span> ast_log(LOG_ERROR, "write() failed: %s\n", strerror(errno));</span><br><span style="color: hsl(0, 100%, 40%);">- if (sig_flags.need_quit || sig_flags.need_quit_handler) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (sig_flags.need_quit || sig_flags.need_quit_handler || sig_flags.need_el_end) {</span><br><span> return;</span><br><span> }</span><br><span> }</span><br><span>@@ -3195,7 +3195,7 @@</span><br><span> char buffer[512] = "", *curline = buffer, *nextline;</span><br><span> int not_written = 1;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (sig_flags.need_quit || sig_flags.need_quit_handler) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (sig_flags.need_quit || sig_flags.need_quit_handler || sig_flags.need_el_end) {</span><br><span> break;</span><br><span> }</span><br><span> </span><br><span>@@ -3255,7 +3255,7 @@</span><br><span> for (;;) {</span><br><span> ebuf = (char *)el_gets(el, &num);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (sig_flags.need_quit || sig_flags.need_quit_handler) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (sig_flags.need_quit || sig_flags.need_quit_handler || sig_flags.need_el_end) {</span><br><span> break;</span><br><span> }</span><br><span> </span><br><span>@@ -4198,6 +4198,12 @@</span><br><span> el_set(el, EL_GETCFN, ast_el_read_char);</span><br><span> </span><br><span> for (;;) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (sig_flags.need_el_end) {</span><br><span style="color: hsl(120, 100%, 40%);">+ el_end(el);</span><br><span style="color: hsl(120, 100%, 40%);">+</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> if (sig_flags.need_quit || sig_flags.need_quit_handler) {</span><br><span> quit_handler(0, SHUTDOWN_FAST, 0);</span><br><span> break;</span><br><span>diff --git a/main/options.c b/main/options.c</span><br><span>index f6a4e8f..1da787f 100644</span><br><span>--- a/main/options.c</span><br><span>+++ b/main/options.c</span><br><span>@@ -322,7 +322,9 @@</span><br><span> ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_QUIET);</span><br><span> /* Run as console (-c at startup, implies nofork) */</span><br><span> } else if (!strcasecmp(v->name, "console")) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_CONSOLE);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!ast_opt_remote) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_CONSOLE);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> /* Run with high priority if the O/S permits (-p at startup) */</span><br><span> } else if (!strcasecmp(v->name, "highpriority")) {</span><br><span> ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIGH_PRIORITY);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10614">change 10614</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/10614"/><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-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I9e23b31d4211417ddc88c6bbfd83ea4c9f3e5438 </div>
<div style="display:none"> Gerrit-Change-Number: 10614 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>