rate_ctr: Make it safe to call rate_ctr_init() several times

There might be library code that has rate counters, and if the main
program calls rate_ctr_init() a second time, we can skip the second
initialization.

Change-Id: I6f5342a77518599eb5ac9a0f0605917a78fcc387
diff --git a/src/rate_ctr.c b/src/rate_ctr.c
index 4d99699..283858d 100644
--- a/src/rate_ctr.c
+++ b/src/rate_ctr.c
@@ -354,6 +354,10 @@
  *  \returns 0 on success; negative on error */
 int rate_ctr_init(void *tall_ctx)
 {
+	/* ignore repeated initialization */
+	if (osmo_timer_pending(&rate_ctr_timer))
+		return 0;
+
 	tall_rate_ctr_ctx = tall_ctx;
 	osmo_timer_setup(&rate_ctr_timer, rate_ctr_timer_cb, NULL);
 	osmo_timer_schedule(&rate_ctr_timer, 1, 0);