<h1>Project "FreeSWITCH Source" received a push.</h1>
<h2>branch: master updated</h2>
<pre>
via: 2ec2a9b0d335a8d6a30ab5a92448ac3ad63649ff (commit)
from: 46f6c6e42d2775ccfecb8f445ebbaaf32ab34df7 (commit)
</pre>= COMMIT LOG ===========================================================
<div class="highlight"><pre>committer: Anthony Minessale
comments:
skip blocking writes on fs_cli to avoid backing up event socket
<span style="color: #000080; font-weight: bold">diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c</span>
<span style="color: #000080; font-weight: bold">index 19e8d7f..a70d63f 100644</span>
<span style="color: #A00000">--- a/libs/esl/fs_cli.c</span>
<span style="color: #00A000">+++ b/libs/esl/fs_cli.c</span>
<span style="color: #800080; font-weight: bold">@@ -589,22 +589,36 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)</span>
        while(thread_running && handle->connected) {
                esl_status_t status = esl_recv_event_timed(handle, 10, 1, NULL);
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                if (WARN_STOP) {</span>
<span style="color: #A00000">-                        printf("Type control-D or /exit or /quit or /bye to exit.\n\n");</span>
<span style="color: #A00000">-                        WARN_STOP = 0;</span>
<span style="color: #A00000">-                }</span>
<span style="color: #00A000">+                int aok = 1;                </span>
                if (status == ESL_FAIL) {
<span style="color: #A00000">-                        esl_log(ESL_LOG_WARNING, "Disconnected.\n");</span>
<span style="color: #00A000">+                        if (aok) esl_log(ESL_LOG_WARNING, "Disconnected.\n");</span>
                        running = -1; thread_running = 0;
                } else if (status == ESL_SUCCESS) {
<span style="color: #00A000">+#ifndef WIN32</span>
<span style="color: #00A000">+                        fd_set can_write;</span>
<span style="color: #00A000">+                        int fd;</span>
<span style="color: #00A000">+                        struct timeval to;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        fd = fileno(stdout);</span>
<span style="color: #00A000">+                        memset(&to, 0, sizeof(to));</span>
<span style="color: #00A000">+                        FD_ZERO(&can_write);</span>
<span style="color: #00A000">+                        FD_SET(fd, &can_write);</span>
<span style="color: #00A000">+                        to.tv_sec = 0;</span>
<span style="color: #00A000">+                        to.tv_usec = 100000;</span>
<span style="color: #00A000">+                        if (select(fd + 1, NULL, &can_write, NULL, &to) > 0) {</span>
<span style="color: #00A000">+                                aok = FD_ISSET(fd, &can_write);</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                aok = 0;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+#endif</span>
<span style="color: #00A000">+                        </span>
                        if (handle->last_event) {
                                const char *type = esl_event_get_header(handle->last_event, "content-type");
                                int known = 0;
                                if (!esl_strlen_zero(type)) {
<span style="color: #A00000">-                                        if (!strcasecmp(type, "log/data")) {</span>
<span style="color: #00A000">+                                        if (aok && !strcasecmp(type, "log/data")) {</span>
                                                const char *userdata = esl_event_get_header(handle->last_event, "user-data");
                                                
                                                if (esl_strlen_zero(userdata) || esl_strlen_zero(filter_uuid) || !strcasecmp(filter_uuid, userdata)) {
<span style="color: #800080; font-weight: bold">@@ -631,7 +645,7 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)</span>
                                        } else if (!strcasecmp(type, "text/disconnect-notice")) {
                                                running = -1; thread_running = 0;
                                                known++;
<span style="color: #A00000">-                                        } else if (!strcasecmp(type, "text/event-plain")) {</span>
<span style="color: #00A000">+                                        } else if (aok && !strcasecmp(type, "text/event-plain")) {</span>
                                                char *foo;
                                                esl_event_serialize(handle->last_ievent, &foo, ESL_FALSE);
                                                printf("RECV EVENT\n%s\n", foo);
<span style="color: #800080; font-weight: bold">@@ -641,7 +655,7 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)</span>
                                        }
                                }
                                
<span style="color: #A00000">-                                if (!known) {</span>
<span style="color: #00A000">+                                if (aok && !known) {</span>
                                        char *foo;
                                        printf("INCOMING DATA [%s]\n%s\n", type, handle->last_event->body ? handle->last_event->body : "");
                                        esl_event_serialize(handle->last_event, &foo, ESL_FALSE);
<span style="color: #800080; font-weight: bold">@@ -651,6 +665,11 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)</span>
                        }
                }
<span style="color: #00A000">+                if (WARN_STOP) {</span>
<span style="color: #00A000">+                        if (aok) printf("Type control-D or /exit or /quit or /bye to exit.\n\n");</span>
<span style="color: #00A000">+                        WARN_STOP = 0;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
                usleep(1000);
        }
</pre></div>
========================================================================<pre>
Summary of changes:
libs/esl/fs_cli.c | 37 ++++++++++++++++++++++++++++---------
1 files changed, 28 insertions(+), 9 deletions(-)
</pre>
<p>this email was generated because of /git/your-repo.git/hooks/post-receive by the file /git-core/contrib/hooks/post-receive-email<br />
For more info, see <a href="http://blog.chomperstomp.com/?p=630">http://blog.chomperstomp.com/?p=630</a>
-- <br />
FreeSWITCH Source</p>