From 3b09338cee1e4a8d251d346d04cd79d2a4721752 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 11 Aug 2006 18:59:25 +0000 Subject: [PATCH] more socket stuff git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2263 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/event_handlers/mod_event_socket/mod_event_socket.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 56ab20cb69..26270ea767 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -254,6 +254,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event, if (*mbuf == '\r' || *mbuf == '\n') { /* bah */ ptr = mbuf; + mbuf[0] = '\0'; continue; } @@ -460,6 +461,9 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t *event snprintf(reply, reply_len, "-ERR invalid log level"); } } else if (!strncasecmp(cmd, "nolog", 5)) { + void *pop; + while (switch_queue_trypop(listener->log_queue, &pop) == SWITCH_STATUS_SUCCESS); + if (switch_test_flag(listener, LFLAG_LOG)) { switch_clear_flag_locked(listener, LFLAG_LOG); snprintf(reply, reply_len, "+OK no longer logging"); @@ -519,6 +523,9 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t *event snprintf(reply, reply_len, "+OK event listener enabled %s", listener->format == EVENT_FORMAT_XML ? "xml" : "plain"); } else if (!strncasecmp(cmd, "noevents", 8)) { + void *pop; + while (switch_queue_trypop(listener->event_queue, &pop) == SWITCH_STATUS_SUCCESS); + if (switch_test_flag(listener, LFLAG_EVENTS)) { uint8_t x = 0; switch_clear_flag_locked(listener, LFLAG_EVENTS);