ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/AnyEvent-SNMP/SNMP.pm
(Generate patch)

Comparing cvsroot/AnyEvent-SNMP/SNMP.pm (file contents):
Revision 1.10 by root, Sun Oct 31 18:15:22 2010 UTC vs.
Revision 1.12 by root, Sun Apr 15 11:02:07 2012 UTC

75 75
76Unfortunately, this number depends not only on processing speed and load 76Unfortunately, this number depends not only on processing speed and load
77of the machine running Net::SNMP, but also on the network latency and the 77of the machine running Net::SNMP, but also on the network latency and the
78speed of your SNMP agents. 78speed of your SNMP agents.
79 79
80AnyEvent::SNMP tries to dynamically adjust this number dynamically upwards 80AnyEvent::SNMP tries to dynamically adjust this number upwards and
81and downwards. 81downwards.
82 82
83Increasing C<$MAX_OUTSTANDING> will not automatically use the 83Increasing C<$MAX_OUTSTANDING> will not automatically use the
84extra request slots. To increase C<$MAX_OUTSTANDING> and make 84extra request slots. To increase C<$MAX_OUTSTANDING> and make
85C<AnyEvent::SNMP> make use of the extra paralellity, call 85C<AnyEvent::SNMP> make use of the extra paralellity, call
86C<AnyEvent::SNMP::set_max_outstanding> with the new value, e.g.: 86C<AnyEvent::SNMP::set_max_outstanding> with the new value, e.g.:
135 135
136=cut 136=cut
137 137
138package AnyEvent::SNMP; 138package AnyEvent::SNMP;
139 139
140no warnings; 140use common::sense;
141use strict qw(subs vars);
142 141
143# it is possible to do this without loading 142# it is possible to do this without loading
144# Net::SNMP::Dispatcher, but much more awkward. 143# Net::SNMP::Dispatcher, but much more awkward.
145use Net::SNMP::Dispatcher; 144use Net::SNMP::Dispatcher;
146 145
146# we could inherit fro Net:SNMP::Dispatcher, but since this is undocumented,
147# I'd rather see it die (and reported) than silenty and subtly fail.
148*msg_handle_alloc = \&Net::SNMP::Dispatcher::msg_handle_alloc;
149
147sub Net::SNMP::Dispatcher::instance { 150sub Net::SNMP::Dispatcher::instance {
148 AnyEvent::SNMP:: 151 AnyEvent::SNMP::
149} 152}
150 153
151use Net::SNMP (); 154use Net::SNMP ();
152use AnyEvent (); 155use AnyEvent ();
153 156
154our $VERSION = '1.0'; 157our $VERSION = '6.0';
155 158
156$Net::SNMP::DISPATCHER = instance Net::SNMP::Dispatcher; 159$Net::SNMP::DISPATCHER = instance Net::SNMP::Dispatcher;
157 160
158our $MESSAGE_PROCESSING = $Net::SNMP::Dispatcher::MESSAGE_PROCESSING; 161our $MESSAGE_PROCESSING = $Net::SNMP::Dispatcher::MESSAGE_PROCESSING;
159 162
338 kick_job; 341 kick_job;
339 342
340 1 343 1
341} 344}
342 345
343sub activate($) { 346sub loop($) {
344 while ($BUSY) { 347 while ($BUSY) {
345 $DONE = AE::cv; 348 $DONE = AE::cv;
346 $DONE->recv; 349 $DONE->recv;
347 undef $DONE; 350 undef $DONE;
348 } 351 }
349} 352}
350 353
354*activate = \&loop; # 5.x compatibility?
355*listen = \&loop; # 5.x compatibility?
356
351sub one_event($) { 357sub one_event($) {
352 # should not ever be used 358 # should not ever be used
353 AnyEvent->one_event; #d# todo 359 AnyEvent->one_event; #d# todo
354} 360}
355 361
356sub set_max_outstanding($) { 362sub set_max_outstanding($) {
357 $MAX_OUTSTANDING = $_[0]; 363 $MAX_OUTSTANDING = $_[0];
358 kick_job; 364 kick_job;
359} 365}
360 366
367# not provided yet:
368# schedule # apparently only used by Net::SNMP::Dispatcher itself
369# register # apparently only used by Net::SNMP::Dispatcher itself
370# deregister # apparently only used by Net::SNMP::Dispatcher itself
371# cancel # apparently only used by Net::SNMP::Dispatcher itself
372# return_response_pdu # apparently not used at all?
373# error # only used by Net::SNMP::Dispatcher itself?
374# debug # only used by Net::SNMP::Dispatcher itself?
375
361=head1 SEE ALSO 376=head1 SEE ALSO
362 377
363L<AnyEvent>, L<Net::SNMP>, L<Net::SNMP::XS>, L<Net::SNMP::EV>. 378L<AnyEvent>, L<Net::SNMP>, L<Net::SNMP::XS>, L<Net::SNMP::EV>.
364 379
365=head1 AUTHOR 380=head1 AUTHOR

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines