From: Daniel Swarbrick Date: Mon, 24 Jan 2011 23:26:58 +0000 (+0100) Subject: make mod_snmp module unload more failsafe X-Git-Tag: v1.2-rc1~187^2~13^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6477d3f87e32cc623638073fc1983ebfc4fa54cd;p=thirdparty%2Ffreeswitch.git make mod_snmp module unload more failsafe --- diff --git a/src/mod/event_handlers/mod_snmp/mod_snmp.c b/src/mod/event_handlers/mod_snmp/mod_snmp.c index 040e82b602..36a133c805 100644 --- a/src/mod/event_handlers/mod_snmp/mod_snmp.c +++ b/src/mod/event_handlers/mod_snmp/mod_snmp.c @@ -98,6 +98,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_snmp_load) netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1); init_agent("mod_snmp"); + + /* + * Override master/subagent ping interval to 5s, to ensure that + * agent_check_and_process() never blocks for longer than that. + */ + netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL, 5); + init_subagent(); init_snmp("mod_snmp"); @@ -107,8 +114,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_snmp_load) SWITCH_MODULE_RUNTIME_FUNCTION(mod_snmp_runtime) { - /* block on select() */ - agent_check_and_process(1); + while (!globals.shutdown) { + /* Block on select() */ + agent_check_and_process(1); + } return SWITCH_STATUS_SUCCESS; }