version 1.50, 2004/07/02 09:28:14
|
version 1.51, 2004/08/26 12:35:10
|
Line 105 my $ConnectionRetriesLeft=2; # Number of
|
Line 105 my $ConnectionRetriesLeft=2; # Number of
|
my $LondVersion = "unknown"; # Version of lond we talk with. |
my $LondVersion = "unknown"; # Version of lond we talk with. |
my $KeyMode = ""; # e.g. ssl, local, insecure from last connect. |
my $KeyMode = ""; # e.g. ssl, local, insecure from last connect. |
|
|
|
my $LongTickLength = 10000000; #Tick Frequency when Idle |
|
my $ShortTickLength = 1; #Tick Frequency when Active (many places in |
|
# the code assume this is one) |
|
my $TickLength = $ShortTickLength;#number of seconds to wait until ticking |
# |
# |
# The hash below gives the HTML format for log messages |
# The hash below gives the HTML format for log messages |
# given a severity. |
# given a severity. |
Line 303 sub Tick {
|
Line 307 sub Tick {
|
|
|
if($IdleConnections->Count() && |
if($IdleConnections->Count() && |
($WorkQueue->Count() == 0)) { # Idle connections and nothing to do? |
($WorkQueue->Count() == 0)) { # Idle connections and nothing to do? |
$IdleSeconds++; |
$IdleSeconds+=$TickLength; |
if($IdleSeconds > $IdleTimeout) { # Prune a connection... |
if($IdleSeconds > $IdleTimeout) { # Prune a connection... |
my $Socket = $IdleConnections->pop(); |
my $Socket = $IdleConnections->pop(); |
KillSocket($Socket); |
KillSocket($Socket); |
|
if ($IdleConnections->Count() == 0) { |
|
&SetupTimer($LongTickLength); |
|
} |
} |
} |
} else { |
} else { |
$IdleSeconds = 0; # Reset idle count if not idle. |
$IdleSeconds = 0; # Reset idle count if not idle. |
Line 370 Trigger disconnections of idle sockets.
|
Line 377 Trigger disconnections of idle sockets.
|
|
|
=cut |
=cut |
|
|
|
my $timer; |
sub SetupTimer { |
sub SetupTimer { |
Debug(6, "SetupTimer"); |
my ($newLength)=@_; |
Event->timer(interval => 1, cb => \&Tick ); |
Debug(6, "SetupTimer $TickLength->$newLength"); |
|
$TickLength=$newLength; |
|
if ($timer) { $timer->cancel; } |
|
$timer=Event->timer(interval => $TickLength, cb => \&Tick ); |
} |
} |
|
|
=pod |
=pod |
Line 1232 sub QueueTransaction {
|
Line 1243 sub QueueTransaction {
|
EmptyQueue(); # Fail transactions, can't make connection. |
EmptyQueue(); # Fail transactions, can't make connection. |
CloseAllLondConnections; # Should all be closed but... |
CloseAllLondConnections; # Should all be closed but... |
} |
} |
|
&SetupTimer($ShortTickLength); |
} else { |
} else { |
ShowStatus(GetServerHost()." >>> DEAD !!!! <<<"); |
ShowStatus(GetServerHost()." >>> DEAD !!!! <<<"); |
EmptyQueue(); # It's worse than that ... he's dead Jim. |
EmptyQueue(); # It's worse than that ... he's dead Jim. |
Line 1521 sub ChildProcess {
|
Line 1533 sub ChildProcess {
|
cb => \&ToggleDebug, |
cb => \&ToggleDebug, |
data => "INT"); |
data => "INT"); |
|
|
SetupTimer(); |
SetupTimer($LongTickLength); |
|
|
SetupLoncListener(); |
SetupLoncListener(); |
|
|