suppress Routed Connections caption if list is empty

This commit is contained in:
Andreas Steffen
2009-05-24 20:06:55 +02:00
parent 7d858a9d3c
commit 90df644ed6
+8 -3
View File
@@ -363,7 +363,7 @@ static void status(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out, bo
child_cfg_t *child_cfg; child_cfg_t *child_cfg;
child_sa_t *child_sa; child_sa_t *child_sa;
ike_sa_t *ike_sa; ike_sa_t *ike_sa;
bool found = FALSE; bool first, found = FALSE;
char *name = msg->status.name; char *name = msg->status.name;
if (all) if (all)
@@ -373,7 +373,6 @@ static void status(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out, bo
host_t *host; host_t *host;
u_int32_t dpd; u_int32_t dpd;
time_t now = time(NULL); time_t now = time(NULL);
bool first = TRUE;
u_int size, online, offline; u_int size, online, offline;
fprintf(out, "Performance:\n"); fprintf(out, "Performance:\n");
@@ -394,6 +393,7 @@ static void status(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out, bo
enumerator->destroy(enumerator); enumerator->destroy(enumerator);
fprintf(out, "\n"); fprintf(out, "\n");
first = TRUE;
enumerator = this->attribute->create_pool_enumerator(this->attribute); enumerator = this->attribute->create_pool_enumerator(this->attribute);
while (enumerator->enumerate(enumerator, &pool, &size, &online, &offline)) while (enumerator->enumerate(enumerator, &pool, &size, &online, &offline))
{ {
@@ -468,10 +468,15 @@ static void status(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out, bo
enumerator->destroy(enumerator); enumerator->destroy(enumerator);
} }
fprintf(out, "Routed Connections:\n"); first = TRUE;
enumerator = charon->traps->create_enumerator(charon->traps); enumerator = charon->traps->create_enumerator(charon->traps);
while (enumerator->enumerate(enumerator, NULL, &child_sa)) while (enumerator->enumerate(enumerator, NULL, &child_sa))
{ {
if (first)
{
fprintf(out, "Routed Connections:\n");
first = FALSE;
}
log_child_sa(out, child_sa, all); log_child_sa(out, child_sa, all);
} }
enumerator->destroy(enumerator); enumerator->destroy(enumerator);