Hello,
I'm embedding an agentx sub-agent in my application and I'm having an odd behavior that I don't know it's normal or not.
Everything was working fine when the main loop for my sub-agent was
while (1) { agent_check_and_process(1); }
GET/SET and sending traps/informs where all working.
Then I changed the main loop code to use snmp_select_info() because there is one extra file descriptor that my application needs to watch for.
The main loop now looks similar to this:
while (1) {
maxfdp1 = 0;
FD_ZERO(&fdset);
memset(&tv, 0, sizeof(tv)); // input timeout value is undefined
block = 1;snmp_select_info(&maxfdp1, &fdset, &tv, &block);
if (block) {
// timeout value returned is undefined
tv.tv_sec = 5;
} // now add my fd
if ((myfd + 1) > maxfdp1)
maxfdp1 = myfd + 1;FD_SET(myfd, &fdset);
ret = select(maxfdp1, &fdset, NULL, NULL, &tv);
if (ret > 0) {
snmp_read(&rdset);
process_my_fd(&rdset);
}
else if (ret == 0) {
snmp_timeout();
}
else if (errno != EINTR) {
perror("select");
}
}What's happening is that the first snmp_select_info() it sets tv_sec equals 14 and tv_usec is 999448.
The second time it returns it sets tv_sec equals 1 and tv_usec is some other random value.
After that snmp_select_info() always returns tv_sec equals 0 and tv_usec is 1.
Also, snmp_select_info() always returns block equals 0.
I tried to set block equals 1 and set I tv_sec to some value before calling snmp_select_info() but the behavior is the same.
Is this behavior correct (returning such a small timeout value) or am I doing something wrong? If this behavior is correct is there anything I can do so net-snmp returns a bigger timeout value?
Thanks, -- Ivens Porto OSE - Open Systems Engineering http://www.ose.com.br Phone: (55) 34 - 3214-5995 Fax: (55) 34 - 3214-5994 Cel: (55) 34 - 8816-9942
------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ Net-snmp-coders mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
