summaryrefslogtreecommitdiff
path: root/cleopatre/application
diff options
context:
space:
mode:
authorYacine Belkadi2011-03-29 17:39:30 +0200
committerYacine Belkadi2011-04-08 16:45:27 +0200
commit82fe4076164f5dce0e55205a7d0fef71d0fc07bb (patch)
treeb1bf3b79cd69990538591296975a9751f158a8bf /cleopatre/application
parent983e928c1c94bec3528cd0d11ef2de490a1f98a6 (diff)
cleo/app/igmp_snoopd: refactor: add update_computed_metrics()
Diffstat (limited to 'cleopatre/application')
-rw-r--r--cleopatre/application/igmp_snoopd/src/igmp_v3.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/cleopatre/application/igmp_snoopd/src/igmp_v3.c b/cleopatre/application/igmp_snoopd/src/igmp_v3.c
index dd83147ddf..983677466b 100644
--- a/cleopatre/application/igmp_snoopd/src/igmp_v3.c
+++ b/cleopatre/application/igmp_snoopd/src/igmp_v3.c
@@ -118,6 +118,24 @@ compute_group_membership_interval (const struct v3_metrics *metrics)
}
/**
+ * Update the computed metrics.
+ *
+ * Some of the metrics are computed from the values of other metrics.
+ * This function updates these computed metrics.
+ *
+ * \param metrics The metrics.
+ */
+void
+update_computed_metrics (struct v3_metrics *metrics)
+{
+ metrics->other_querier_present_interval =
+ compute_other_querier_present_interval (metrics);
+
+ metrics->group_membership_interval =
+ compute_group_membership_interval (metrics);
+}
+
+/**
* Update some timers and timestamps in the group and member.
* They are used to keep track of (in)activity.
* \param grp The group.
@@ -205,11 +223,7 @@ init_v3 (struct v3_metrics *metrics)
metrics->robustness_variable = DEFAULT_ROBUSTNESS_VARIABLE;
metrics->query_interval = DEFAULT_QUERY_INTERVAL;
metrics->query_response_interval = DEFAULT_QUERY_RESPONSE_INTERVAL;
-
- metrics->other_querier_present_interval =
- compute_other_querier_present_interval (metrics);
- metrics->group_membership_interval =
- compute_group_membership_interval (metrics);
+ update_computed_metrics (metrics);
}
void
@@ -282,11 +296,7 @@ process_v3_query (struct context *ctx,
} /* the else case is already handled by a previous if in this function */
- ctx->metrics.other_querier_present_interval =
- compute_other_querier_present_interval (&ctx->metrics);
-
- ctx->metrics.group_membership_interval =
- compute_group_membership_interval (&ctx->metrics);
+ update_computed_metrics (&ctx->metrics);
}
/**