PROXY  WHOIS  RQUOTE  TEXTS  SOFT  FOREX  BBOARD
 Music  Philosophy  Code  Literature  Russian

= ROOT|Technical|Code_Examples|Perl|site_perl|AnyEvent|DNS.pm =

page 14 of 14



Wait until a free request slot is available and call the callback with the
resolver object.

A request slot is used each time a request is actually sent to the
nameservers: There are never more than C<max_outstanding> of them.

Although you can submit more requests (they will simply be queued until
a request slot becomes available), sometimes, usually for rate-limiting
purposes, it is useful to instead wait for a slot before generating the
request (or simply to know when the request load is low enough so one can
submit requests again).

This is what this method does: The callback will be called when submitting
a DNS request will not result in that request being queued. The callback
may or may not generate any requests in response.

Note that the callback will only be invoked when the request queue is
empty, so this does not play well if somebody else keeps the request queue
full at all times.

=cut

sub wait_for_slot {
   my ($self, $cb) = @_;

   push @{ $self->{wait} }, $cb;
   $self->_scheduler;
}

use AnyEvent::Socket (); # circular dependency, so do not import anything and do it at the end

1;

=back

=head1 AUTHOR

   Marc Lehmann <schmorp@schmorp.de>
   http://home.schmorp.de/

=cut

=14=
THE END

1.8|9|10|11|12|13| < PREV = PAGE 14 =

UP TO ROOT | UP TO DIR | TO FIRST PAGE

Google
 

E-mail Facebook Google Digg del.icio.us BlinkList Fark Furl Ma.gnolia Netscape NewsVine Reddit Slashdot Spurl StumbleUpon Technorati YahooMyWeb LiveJournal Blogmarks TwitThis Live News2.ru BobrDobr.ru Memori.ru MoeMesto.ru

0.00738811 wallclock secs ( 0.01 usr + 0.00 sys = 0.01 CPU)