udp: Poll SNMP for timeouts and fd every 100ms
This is the easiest way to integrate net-snmp with the event loop,
every 100ms we are going to check for timeouts or incoming messages
diff --git a/src/link_udp.c b/src/link_udp.c
index 04dcec8..fd6b1f9 100644
--- a/src/link_udp.c
+++ b/src/link_udp.c
@@ -232,6 +232,13 @@
return 0;
}
+static void snmp_poll(void *_data)
+{
+ struct mtp_udp_data *data = _data;
+ snmp_mtp_poll();
+ bsc_schedule_timer(&data->snmp_poll, 0, 5000);
+}
+
int link_global_init(struct mtp_udp_data *data, int src_port)
{
struct sockaddr_in addr;
@@ -274,5 +281,9 @@
return -1;
}
+ data->snmp_poll.data = data;
+ data->snmp_poll.cb = snmp_poll;
+ snmp_poll(data);
+
return 0;
}