]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Log non-empty task queues in statusall
authorMartin Willi <martin@revosec.ch>
Mon, 7 Jun 2010 09:59:37 +0000 (11:59 +0200)
committerMartin Willi <martin@revosec.ch>
Mon, 7 Jun 2010 09:59:37 +0000 (11:59 +0200)
src/libcharon/plugins/stroke/stroke_list.c

index c2a98da335def5e9cb42c399cfaf5add7dedbc0b..153828ae8e944edf9d7123f40497622ad8fa6a06 100644 (file)
@@ -54,6 +54,33 @@ struct private_stroke_list_t {
        stroke_attribute_t *attribute;
 };
 
+/**
+ * Log tasks of a specific queue to out
+ */
+static void log_task_q(FILE *out, ike_sa_t *ike_sa, task_queue_t q, char *name)
+{
+       enumerator_t *enumerator;
+       bool has = FALSE;
+       task_t *task;
+
+       enumerator = ike_sa->create_task_enumerator(ike_sa, q);
+       while (enumerator->enumerate(enumerator, &task))
+       {
+               if (!has)
+               {
+                       fprintf(out, "%12s[%d]: Tasks %s: ", ike_sa->get_name(ike_sa),
+                                       ike_sa->get_unique_id(ike_sa), name);
+                       has = TRUE;
+               }
+               fprintf(out, "%N ", task_type_names, task->get_type(task));
+       }
+       enumerator->destroy(enumerator);
+       if (has)
+       {
+               fprintf(out, "\n");
+       }
+}
+
 /**
  * log an IKE_SA to out
  */
@@ -140,6 +167,10 @@ static void log_ike_sa(FILE *out, ike_sa_t *ike_sa, bool all)
                                        ike_sa->get_name(ike_sa), ike_sa->get_unique_id(ike_sa),
                                        buf+4);
                }
+
+               log_task_q(out, ike_sa, TASK_QUEUE_QUEUED, "queued");
+               log_task_q(out, ike_sa, TASK_QUEUE_ACTIVE, "active");
+               log_task_q(out, ike_sa, TASK_QUEUE_PASSIVE, "passive");
        }
 }