ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent/DNS.pm
(Generate patch)

Comparing AnyEvent/lib/AnyEvent/DNS.pm (file contents):
Revision 1.51 by root, Fri May 30 05:56:20 2008 UTC vs.
Revision 1.52 by root, Fri May 30 08:17:10 2008 UTC

974 my ($res) = @_; 974 my ($res) = @_;
975 975
976 if ($res->{tc}) { 976 if ($res->{tc}) {
977 # success, but truncated, so use tcp 977 # success, but truncated, so use tcp
978 AnyEvent::Socket::tcp_connect (AnyEvent::Socket::format_address ($server), DOMAIN_PORT, sub { 978 AnyEvent::Socket::tcp_connect (AnyEvent::Socket::format_address ($server), DOMAIN_PORT, sub {
979 return unless $do_retry; # some other request could have invalidated us already
980
979 my ($fh) = @_ 981 my ($fh) = @_
980 or return &$do_retry; 982 or return &$do_retry;
981 983
982 my $handle = new AnyEvent::Handle 984 my $handle; $handle = new AnyEvent::Handle
983 fh => $fh, 985 fh => $fh,
986 timeout => $timeout,
984 on_error => sub { 987 on_error => sub {
988 undef $handle;
989 return unless $do_retry; # some other request could have invalidated us already
985 # failure, try next 990 # failure, try next
986 &$do_retry; 991 &$do_retry;
987 }; 992 };
988 993
989 $handle->push_write (pack "n/a", $req->[0]); 994 $handle->push_write (pack "n/a", $req->[0]);
990 $handle->push_read (chunk => 2, sub { 995 $handle->push_read (chunk => 2, sub {
991 $handle->unshift_read (chunk => (unpack "n", $_[1]), sub { 996 $handle->unshift_read (chunk => (unpack "n", $_[1]), sub {
997 undef $handle;
992 $self->_feed ($_[1]); 998 $self->_feed ($_[1]);
993 }); 999 });
994 }); 1000 });
995 shutdown $fh, 1;
996 1001
997 }, sub { $timeout }); 1002 }, sub { $timeout });
998 1003
999 } else { 1004 } else {
1000 # success 1005 # success

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines