Greetings All, This started when I needed to (with relative swiftness) whip up a threaded snmp poller using getbulk operations to pull interface stats off a large number of devices. And while I'm toying with the idea of porting it to C, I suspect there may be some desire in the community for thread-safety in the XS glue.
The patch involves a toggle function that is referenced to decide whether to
use Traditional (not thread-safe) or Single-Session (thread-safe) API
calls. It's not the most graceful code ever, and it doesn't cover every
possibility (Currently breaks the setting of $sess->{ErrorStr} &
$sess->{ErrorNum}, and there's a close_sess() function that would be better
placed in DESTROY() so it gets called automatically when it passes out of
scope), but it is at least functional for my purposes presently ( gettable()
using getbulk ops or falling back on getnext() for v1 clients).
Example code is attached (test_for_snmplist). The behavior I would see
previous to the patch was that all threads but one would hang waiting for a
response PDU, presumably because the Traditional API synch call collects all
the return information from any active SNMP session.
If there's actual community interest, I'll try to make it more complete.
RFC
- ccoyle
test_for_snmplist
Description: Binary data
snmp-5.4.1_XS_single.patch
Description: Binary data
------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
