[asterisk-commits] mmichelson: branch group/manager2 r110441 - in /team/group/manager2: apps/ res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Mar 20 18:46:05 CDT 2008
Author: mmichelson
Date: Thu Mar 20 18:46:05 2008
New Revision: 110441
URL: http://svn.digium.com/view/asterisk?view=rev&rev=110441
Log:
Change the event_spitter to use ast_str to build up the string and then
write it to the console. Using a single large string like this will help
to facilitate an easier write to the manager socket when the time comes
Modified:
team/group/manager2/apps/app_queue.c
team/group/manager2/res/res_manager2.c
Modified: team/group/manager2/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/apps/app_queue.c?view=diff&rev=110441&r1=110440&r2=110441
==============================================================================
--- team/group/manager2/apps/app_queue.c (original)
+++ team/group/manager2/apps/app_queue.c Thu Mar 20 18:46:05 2008
@@ -714,7 +714,7 @@
AST_EVENT_IE_QUEUE_PENALTY, cur->penalty,
AST_EVENT_IE_QUEUE_CALLS, cur->calls,
AST_EVENT_IE_QUEUE_LASTCALL, cur->lastcall,
- AST_EVENT_IE_STATE, devstate2str(cur->status),
+ AST_EVENT_IE_STATE, cur->status,
AST_EVENT_IE_QUEUE_PAUSED, cur->paused,
AST_EVENT_IE_END);
ast_event_queue(event);
Modified: team/group/manager2/res/res_manager2.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/res/res_manager2.c?view=diff&rev=110441&r1=110440&r2=110441
==============================================================================
--- team/group/manager2/res/res_manager2.c (original)
+++ team/group/manager2/res/res_manager2.c Thu Mar 20 18:46:05 2008
@@ -69,6 +69,8 @@
ast_mutex_unlock(&info_thread.lock);
}
+AST_THREADSTORAGE(manager_event_buf);
+#define MANAGER_EVENT_BUF_INITSIZE 256
/*! \brief The handler for manager subscriptions
* In its rudimentary stage here, all this does is iterate
* through the IEs in the event and print them as debug messages
@@ -80,6 +82,7 @@
while(!info_thread.stop) {
struct ast_event_iterator iter;
int res = 0;
+ struct ast_str *buf;
ast_mutex_lock(&info_thread.lock);
if (!(event = AST_LIST_REMOVE_HEAD(&info_thread.info_events, list))) {
ast_cond_wait(&info_thread.cond, &info_thread.lock);
@@ -94,15 +97,25 @@
if (!event)
continue;
+ if (!(buf = ast_str_thread_get(&manager_event_buf, MANAGER_EVENT_BUF_INITSIZE))) {
+ /* OH CRAP */
+ }
+
for (ast_event_iterator_init(&iter, event->event); !res; res = ast_event_iterator_next(&iter)) {
enum ast_event_ie_type ie_type = ast_event_iterator_get_ie_type(&iter);
if (ie_type == AST_EVENT_IE_END)
break;
if (ast_event_ie_get_pltype(ie_type) == AST_EVENT_IE_PLTYPE_STR)
- ast_log(LOG_DEBUG, "%s: %s\r\n", ast_event_ie_get_name(ie_type), ast_event_iterator_get_ie_str(&iter));
+ ast_str_append(&buf, 0, "%s: %s\r\n", ast_event_ie_get_name(ie_type), ast_event_iterator_get_ie_str(&iter));
else if (ast_event_ie_get_pltype(ie_type) == AST_EVENT_IE_PLTYPE_UINT)
- ast_log(LOG_DEBUG, "%s: %u\r\n", ast_event_ie_get_name(ie_type), ast_event_iterator_get_ie_uint(&iter));
+ ast_str_append(&buf, 0, "%s: %u\r\n", ast_event_ie_get_name(ie_type), ast_event_iterator_get_ie_uint(&iter));
}
+
+ /*Now we need to write the string to manager socket...
+ * for now continue to output to console
+ */
+ ast_debug(0, "%s", buf->str);
+
ast_event_destroy(event->event);
ast_free(event);
event = NULL;
More information about the asterisk-commits
mailing list