Merge branch 'stroke-counters'
Extend stroke counters functionality by connection specific counters, and a resetcounters command to reset the global or connection counters.
This commit is contained in:
@@ -388,17 +388,14 @@ static void stroke_status(private_stroke_socket_t *this,
|
||||
/**
|
||||
* list various information
|
||||
*/
|
||||
static void stroke_list(private_stroke_socket_t *this, stroke_msg_t *msg, FILE *out)
|
||||
static void stroke_list(private_stroke_socket_t *this, stroke_msg_t *msg,
|
||||
FILE *out)
|
||||
{
|
||||
if (msg->list.flags & LIST_CAINFOS)
|
||||
{
|
||||
this->ca->list(this->ca, msg, out);
|
||||
}
|
||||
this->list->list(this->list, msg, out);
|
||||
if (msg->list.flags & LIST_COUNTERS)
|
||||
{
|
||||
this->counter->print(this->counter, out);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -504,6 +501,24 @@ static void stroke_user_creds(private_stroke_socket_t *this,
|
||||
this->config->set_user_credentials(this->config, msg, out);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print stroke counter values
|
||||
*/
|
||||
static void stroke_counters(private_stroke_socket_t *this,
|
||||
stroke_msg_t *msg, FILE *out)
|
||||
{
|
||||
pop_string(msg, &msg->counters.name);
|
||||
|
||||
if (msg->counters.reset)
|
||||
{
|
||||
this->counter->reset(this->counter, msg->counters.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->counter->print(this->counter, out, msg->counters.name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* set the verbosity debug output
|
||||
*/
|
||||
@@ -672,6 +687,9 @@ static job_requeue_t process(stroke_job_context_t *ctx)
|
||||
case STR_USER_CREDS:
|
||||
stroke_user_creds(this, msg, out);
|
||||
break;
|
||||
case STR_COUNTERS:
|
||||
stroke_counters(this, msg, out);
|
||||
break;
|
||||
default:
|
||||
DBG1(DBG_CFG, "received unknown stroke");
|
||||
break;
|
||||
@@ -862,4 +880,3 @@ stroke_socket_t *stroke_socket_create()
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user