This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Pau Espin Pedrol gerrit-no-reply at lists.osmocom.orgPau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/13281
Change subject: Integrate sleeping/printing loop into osmo main loop
......................................................................
Integrate sleeping/printing loop into osmo main loop
Among other possibles issue, it should avoid sporadic print loop hanging if no events are fired in osmocom main loop.
Change-Id: Ie2f0983eaf75826483b5b70f58b4d4acb842d6ea
---
M src/osysmon_main.c
1 file changed, 27 insertions(+), 19 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sysmon refs/changes/81/13281/1
diff --git a/src/osysmon_main.c b/src/osysmon_main.c
index c2df6ad..1ba3753 100644
--- a/src/osysmon_main.c
+++ b/src/osysmon_main.c
@@ -35,6 +35,7 @@
#include <osmocom/core/msgb.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/application.h>
+#include <osmocom/core/timer.h>
static struct log_info log_info = {};
@@ -191,9 +192,31 @@
}
}
+static struct osmo_timer_list print_timer;
+int ping_init;
+
+static void print_nodes(__attribute__((unused)) void *data)
+{
+ struct value_node *root = value_node_add(NULL, "root", NULL);
+ osysmon_openvpn_poll(root);
+ osysmon_sysinfo_poll(root);
+ osysmon_ctrl_poll(root);
+ osysmon_rtnl_poll(root);
+
+ if (ping_init == 0)
+ osysmon_ping_poll(root);
+
+ osysmon_file_poll(root);
+
+ display_update(root);
+ value_node_del(root);
+
+ osmo_timer_schedule(&print_timer, 1, 0);
+}
+
int main(int argc, char **argv)
{
- int rc, ping_init;
+ int rc;
osmo_init_logging2(NULL, &log_info);
@@ -231,26 +254,11 @@
}
}
- while (1) {
- struct value_node *root = value_node_add(NULL, "root", NULL);
- int vpns = osysmon_openvpn_poll(root);
- osysmon_sysinfo_poll(root);
- osysmon_ctrl_poll(root);
- osysmon_rtnl_poll(root);
+ osmo_timer_setup(&print_timer, print_nodes, NULL);
+ osmo_timer_schedule(&print_timer, 0, 0);
- if (ping_init == 0)
- osysmon_ping_poll(root);
-
- osysmon_file_poll(root);
-
- display_update(root);
- value_node_del(root);
-
- if (vpns)
+ while (1)
osmo_select_main(0);
- sleep(1);
- }
-
exit(0);
}
--
To view, visit https://gerrit.osmocom.org/13281
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-sysmon
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie2f0983eaf75826483b5b70f58b4d4acb842d6ea
Gerrit-Change-Number: 13281
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190315/c59c7b3b/attachment.htm>