[svn-commits] dhubbard: branch group/taskprocessors r111952 - /team/group/taskprocessors/main/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Sat Mar 29 14:42:15 CDT 2008
Author: dhubbard
Date: Sat Mar 29 14:42:15 2008
New Revision: 111952
URL: http://svn.digium.com/view/asterisk?view=rev&rev=111952
Log:
taskprocessor ping source improvements inspired by a delicious omelette
Modified:
team/group/taskprocessors/main/taskprocessor.c
Modified: team/group/taskprocessors/main/taskprocessor.c
URL: http://svn.digium.com/view/asterisk/team/group/taskprocessors/main/taskprocessor.c?view=diff&rev=111952&r1=111951&r2=111952
==============================================================================
--- team/group/taskprocessors/main/taskprocessor.c (original)
+++ team/group/taskprocessors/main/taskprocessor.c Sat Mar 29 14:42:15 2008
@@ -146,6 +146,7 @@
static char *cli_taskprocessor_ping(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct timeval begin, end, delta;
+ char *name;
int found = 0;
struct a_task *t = NULL;
struct taskprocessor_singleton_info *tps = NULL;
@@ -164,10 +165,11 @@
if (a->argc != 3)
return CLI_SHOWUSAGE;
+ name = a->argv[2];
AST_LIST_LOCK(&_taskprocessor_singletons);
AST_LIST_TRAVERSE(&_taskprocessor_singletons, tps, list) {
ast_mutex_lock(&tps->_taskprocessor_lock);
- if (!strcasecmp(tps->_name, a->argv[2])) {
+ if (!strcasecmp(tps->_name, name)) {
found = 1;
}
ast_mutex_unlock(&tps->_taskprocessor_lock);
@@ -176,16 +178,17 @@
AST_LIST_UNLOCK(&_taskprocessor_singletons);
if (!found || !tps) {
- ast_cli(a->fd, "\nping failed: %s not found\n\n", a->argv[2]);
+ ast_cli(a->fd, "\nping failed: %s not found\n\n", name);
return CLI_SUCCESS;
}
t = ast_task_alloc(tps_taskprocessor_ping_handler, 0, "cli_taskprocessor_ping");
begin = ast_tvnow();
if (ast_taskprocessor_push(tps, t) < 0) {
- ast_cli(a->fd, "\nping failed: could not push task to %s\n\n", a->argv[2]);
+ ast_cli(a->fd, "\nping failed: could not push task to %s\n\n", name);
ast_task_free(t);
}
+ ast_cli(a->fd, "\npinging %s ...", name);
ast_mutex_lock(&tps->_taskprocessor_lock);
ast_cond_signal(&tps->_poll_cond);
ast_mutex_unlock(&tps->_taskprocessor_lock);
@@ -195,7 +198,7 @@
ast_mutex_unlock(&_cli_ping_cond_lock);
end = ast_tvnow();
delta = ast_tvsub(end, begin);
- ast_cli(a->fd, "\n%24s ping time: %.1ld.%.6ld sec\n\n", a->argv[2], delta.tv_sec, (long int)delta.tv_usec);
+ ast_cli(a->fd, "\n\t%24s ping time: %.1ld.%.6ld sec\n\n", name, delta.tv_sec, (long int)delta.tv_usec);
return CLI_SUCCESS;
}
More information about the svn-commits
mailing list