mirror of
https://github.com/darold/squidanalyzer.git
synced 2025-07-29 08:54:16 +02:00
Set default timeout for DNS lookup to 100ms, default value for DNSLookupTimeout is now 0.0001 second.
This commit is contained in:
parent
c6163b817a
commit
b1810b233b
6
README
6
README
@ -189,11 +189,11 @@ CONFIGURATION
|
||||
DNS name instead. Note that you must have a working DNS resolution
|
||||
and that it can really slow down the generation of reports.
|
||||
|
||||
DNSLookupTimeout 1
|
||||
DNSLookupTimeout 0.0001
|
||||
If you have enabled UseClientDNSName and have lot of ip addresses
|
||||
that do not resolve you may want to increase the DNS lookup timeout.
|
||||
By default SquidAnalyzer will stop to lookup a DNS name after one
|
||||
second.
|
||||
By default SquidAnalyzer will stop to lookup a DNS name after 0.0001
|
||||
second (100 ms).
|
||||
|
||||
NetworkAlias network-aliases_file
|
||||
Set path to the file containing network alias name. Network are show
|
||||
|
@ -19,6 +19,7 @@ BEGIN {
|
||||
use POSIX qw/ strftime /;
|
||||
use IO::File;
|
||||
use Socket;
|
||||
use Time::HiRes qw/ualarm/;
|
||||
|
||||
# Set all internal variable
|
||||
$VERSION = '5.3';
|
||||
@ -652,7 +653,8 @@ sub _init
|
||||
$self->{TopUrlUser} = $options{TopUrlUser} || 0;
|
||||
$self->{no_year_stat} = 0;
|
||||
$self->{UseClientDNSName} = $options{UseClientDNSName} || 0;
|
||||
$self->{DNSLookupTimeout} = $options{DNSLookupTimeout} || 1;
|
||||
$self->{DNSLookupTimeout} = $options{DNSLookupTimeout} || 0.0001;
|
||||
$self->{DNSLookupTimeout} = int($self->{DNSLookupTimeout} * 1000000);
|
||||
|
||||
if ($self->{Lang}) {
|
||||
open(IN, "$self->{Lang}") or die "ERROR: can't open translation file $self->{Lang}, $!\n";
|
||||
@ -807,15 +809,13 @@ sub _gethostbyaddr
|
||||
{
|
||||
my ($self, $ip) = @_;
|
||||
|
||||
return $ip unless $ip=~/\d+\.\d+\.\d+\.\d+/;
|
||||
|
||||
my $host = undef;
|
||||
unless(exists $CACHE{$ip}) {
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { die "timeout\n" };
|
||||
alarm $self->{DNSLookupTimeout};
|
||||
local $SIG{ALRM} = sub { die "DNS lookup timeout.\n"; };
|
||||
ualarm $self->{DNSLookupTimeout};
|
||||
$host = gethostbyaddr(inet_aton($ip), AF_INET);
|
||||
alarm 0;
|
||||
ualarm 0;
|
||||
};
|
||||
if ($@) {
|
||||
$CACHE{$ip} = undef;
|
||||
|
@ -199,11 +199,11 @@ the client ip address, this allow you to use the DNS name instead.
|
||||
Note that you must have a working DNS resolution and that it can really slow
|
||||
down the generation of reports.
|
||||
|
||||
=item DNSLookupTimeout 1
|
||||
=item DNSLookupTimeout 0.0001
|
||||
|
||||
If you have enabled UseClientDNSName and have lot of ip addresses that do not
|
||||
resolve you may want to increase the DNS lookup timeout. By default SquidAnalyzer
|
||||
will stop to lookup a DNS name after one second.
|
||||
will stop to lookup a DNS name after 0.0001 second (100 ms).
|
||||
|
||||
=item NetworkAlias network-aliases_file
|
||||
|
||||
|
@ -22,8 +22,8 @@ UseClientDNSName 0
|
||||
|
||||
# If you have enabled UseClientDNSName and have lot of ip addresses that do
|
||||
# not resolve you may want to increase the DNS lookup timeout. By default
|
||||
# SquidAnalyzer will stop to lookup a DNS name after one second.
|
||||
DNSLookupTimeout 1
|
||||
# SquidAnalyzer will stop to lookup a DNS name after 0.0001 second (100 ms).
|
||||
DNSLookupTimeout 0.0001
|
||||
|
||||
# Set the file containing network alias name. Network are
|
||||
# show as Ip addresses so if you want to display name instead
|
||||
|
Loading…
x
Reference in New Issue
Block a user