summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@espeweb.net>2021-02-05 16:55:18 +0100
committerPau Espin Pedrol <pespin@espeweb.net>2021-02-08 12:36:42 +0100
commitfb14690c81cb5da60ac52ee852ef4afc03a2e58c (patch)
tree996a768a54a87d5e82b4b8432596818dca6b62a8
parent6ee0126971c83fd60658761263af559a482f13d9 (diff)
StatsD_Checker: Check f_IPL4_listen result
-rw-r--r--library/StatsD_Checker.ttcn10
1 files changed, 9 insertions, 1 deletions
diff --git a/library/StatsD_Checker.ttcn b/library/StatsD_Checker.ttcn
index d287b744..540e479b 100644
--- a/library/StatsD_Checker.ttcn
+++ b/library/StatsD_Checker.ttcn
@@ -25,6 +25,9 @@ module StatsD_Checker {
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+import from Misc_Helpers all;
+import from Socket_API_Definitions all;
+
import from StatsD_Types all;
import from StatsD_CodecPort all;
import from StatsD_CodecPort_CtrlFunct all;
@@ -90,6 +93,7 @@ type port STATSD_PROC_PT procedure {
function main(charstring statsd_host, integer statsd_port) runs on StatsD_Checker_CT {
var StatsD_ConnHdlr vc_conn;
var StatsDExpects expects;
+ var Result res;
while (not mp_enable_stats) {
log("StatsD checker disabled by modulepar");
@@ -97,7 +101,11 @@ function main(charstring statsd_host, integer statsd_port) runs on StatsD_Checke
}
map(self:STATS, system:STATS);
- StatsD_CodecPort_CtrlFunct.f_IPL4_listen(STATS, statsd_host, statsd_port, { udp := {} }, {});
+ res := StatsD_CodecPort_CtrlFunct.f_IPL4_listen(STATS, statsd_host, statsd_port, { udp := {} }, {});
+ if (not ispresent(res.connId)) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ "Could not bind StatsD socket, check your configuration");
+ }
/* Connect to VTY and reset stats */
map(self:STATSVTY, system:STATSVTY);