fields patch from Brian Grossman

git-svn-id: https://svn.perl.org/qpsmtpd/trunk@644 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Matt Sergeant 2006-06-20 14:39:52 +00:00
parent f31d18c6cd
commit 5ff2ef7cac

View File

@ -273,6 +273,8 @@ sub close {
package Danga::DNS::Resolver::Query; package Danga::DNS::Resolver::Query;
use fields qw( resolver asker host type timeout id data repeat ns nqueries );
use constant MAX_QUERIES => 10; use constant MAX_QUERIES => 10;
sub trace { sub trace {
@ -281,24 +283,14 @@ sub trace {
} }
sub new { sub new {
my ($class, $res, $asker, $host, $type, $now, $id, $data) = @_; my Danga::DNS::Resolver::Query $self = shift;
$self = fields::new($self) unless ref $self;
my $self = { @$self{qw( resolver asker host type timeout id data )} = @_;
resolver => $res, # repeat is number of retries
asker => $asker, @$self{qw( repeat ns nqueries )} = (2,0,0);
host => $host,
type => $type,
timeout => $now,
id => $id,
data => $data,
repeat => 2, # number of retries
ns => 0,
nqueries => 0,
};
trace(2, "NS Query: $host ($id)\n"); trace(2, "NS Query: $self->{host} ($self->{id})\n");
bless $self, $class;
$self->send_query || return; $self->send_query || return;