]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
snmp: only call run_alarms() on SNMP timeouts
authorVincent Bernat <bernat@luffy.cx>
Thu, 3 May 2012 08:59:42 +0000 (10:59 +0200)
committerVincent Bernat <bernat@luffy.cx>
Thu, 3 May 2012 08:59:42 +0000 (10:59 +0200)
See snmp_alarm(3snmp) manual page for the
rationale. `NETSNMP_DS_LIB_ALARM_DONT_USE_SIG` is set by
`init_agent()`.

src/event.c

index 2e82c3e2547021e05886981124e94f738cd5e48c..3666e340419e1b20d46453e50194b12dfa5343ea 100644 (file)
@@ -77,6 +77,7 @@ levent_snmp_timeout(evutil_socket_t fd, short what, void *arg)
        (void)what; (void)fd;
        struct lldpd *cfg = arg;
        snmp_timeout();
+       run_alarms();
        levent_snmp_update(cfg);
 }
 
@@ -340,11 +341,12 @@ levent_loop(struct lldpd *cfg)
                        break;
 #ifdef USE_SNMP
                if (cfg->g_snmp) {
-                       run_alarms();
+                       /* We don't use delegated requests (request
+                          whose answer is delayed). However, we keep
+                          the call here in case we use it some
+                          day. We don't call run_alarms() here. We do
+                          it on timeout only. */
                        netsnmp_check_outstanding_agent_requests();
-                       /* run_alarms() may establish new connections and then
-                          synchronously modify the set of SNMP FD. We need to
-                          update them. */
                        levent_snmp_update(cfg);
                }
 #endif