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