select: gather statistics for TCP connections

osmocom applications are deployed in a variety of different situations.
Dependung on the medium that interconnects the network components
unexpected behaviour may occur. To debug problems with the
interconnection between network components it might help to monitor the
health of the related TCP connections.

Change-Id: I1416f95aff2adcf13689646b7574845de169fa3d
Related: SYS#5701
diff --git a/src/stats.c b/src/stats.c
index f8c91fd..4267284 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -85,6 +85,7 @@
 #include <osmocom/core/select.h>
 #include <osmocom/core/counter.h>
 #include <osmocom/core/msgb.h>
+#include <osmocom/core/stats_tcp.h>
 
 #ifdef HAVE_SYSTEMTAP
 /* include the generated probes header and put markers in code */
@@ -240,6 +241,10 @@
 	osmo_stats_ctx = ctx;
 	is_initialised = 1;
 	start_timer();
+
+	/* Make sure that the tcp-stats interval timer also runs at its
+	 * preconfigured rate. The vty might change this setting later. */
+	osmo_stats_tcp_set_interval(osmo_tcp_stats_config->interval);
 }
 
 /*! Find a stats_reporter of given \a type and \a name.