version 1.90, 2010/12/20 11:15:51
|
version 1.95, 2011/01/24 11:02:32
|
Line 85 my $ClientConnection = 0; # Uniquifier f
|
Line 85 my $ClientConnection = 0; # Uniquifier f
|
|
|
my $DebugLevel = 0; |
my $DebugLevel = 0; |
my $NextDebugLevel= 2; # So Sigint can toggle this. |
my $NextDebugLevel= 2; # So Sigint can toggle this. |
my $IdleTimeout= 7200; # Wait two hours before pruning connections. |
my $IdleTimeout= 5*60; # Seconds to wait prior to pruning connections. |
|
|
my $LogTransactions = 0; # When True, all transactions/replies get logged. |
my $LogTransactions = 0; # When True, all transactions/replies get logged. |
my $executable = $0; # Get the full path to me. |
my $executable = $0; # Get the full path to me. |
Line 441 Trigger disconnections of idle sockets.
|
Line 441 Trigger disconnections of idle sockets.
|
|
|
sub SetupTimer { |
sub SetupTimer { |
Debug(6, "SetupTimer"); |
Debug(6, "SetupTimer"); |
Event->timer(interval => 1, cb => \&Tick ); |
Event->timer(interval => 1, cb => \&Tick, |
|
hard => 1); |
} |
} |
|
|
=pod |
=pod |
Line 945 sub LondReadable {
|
Line 946 sub LondReadable {
|
CompleteTransaction($Socket, |
CompleteTransaction($Socket, |
$ActiveTransactions{$Socket}); |
$ActiveTransactions{$Socket}); |
} else { |
} else { |
Log("SUCCESS", "Connection ".$ConnectionCount." to " |
my $count = $Socket->GetClientData(); |
|
Log("SUCCESS", "Connection ".$count." to " |
.$RemoteHost." now ready for action"); |
.$RemoteHost." now ready for action"); |
} |
} |
ServerToIdle($Socket); # Next work unit or idle. |
ServerToIdle($Socket); # Next work unit or idle. |
Line 1239 sub MakeLondConnection {
|
Line 1241 sub MakeLondConnection {
|
&SetupTimer; # Need to handle timeouts with connections... |
&SetupTimer; # Need to handle timeouts with connections... |
} |
} |
$ConnectionCount++; |
$ConnectionCount++; |
|
$Connection->SetClientData($ConnectionCount); |
Debug(4, "Connection count = ".$ConnectionCount); |
Debug(4, "Connection count = ".$ConnectionCount); |
if($ConnectionCount == 1) { # First Connection: |
if($ConnectionCount == 1) { # First Connection: |
QueueDelayed; |
QueueDelayed; |
Line 1350 sub QueueTransaction {
|
Line 1353 sub QueueTransaction {
|
} |
} |
} |
} |
|
|
#-------------------------- Lonc UNIX socket handling --------------------- |
#-------------------------- Lonc UNIX socket handling ------------------- |
|
|
=pod |
=pod |
|
|
=head2 ClientRequest |
=head2 ClientRequest |
Line 1732 sub ChildProcess {
|
Line 1734 sub ChildProcess {
|
cb => \&ToggleDebug, |
cb => \&ToggleDebug, |
data => "INT"); |
data => "INT"); |
|
|
|
# Block the pipe signal we'll get when the socket disconnects. We detect |
|
# socket disconnection via send/receive failures. On disconnect, the |
|
# socket becomes readable .. which will force the disconnect detection. |
|
|
|
my $set = POSIX::SigSet->new(SIGPIPE); |
|
sigprocmask(SIG_BLOCK, $set); |
|
|
# Figure out if we got passed a socket or need to open one to listen for |
# Figure out if we got passed a socket or need to open one to listen for |
# client requests. |
# client requests. |
|
|
Line 1775 sub CreateChild {
|
Line 1784 sub CreateChild {
|
my $sigset = POSIX::SigSet->new(SIGINT); |
my $sigset = POSIX::SigSet->new(SIGINT); |
sigprocmask(SIG_BLOCK, $sigset); |
sigprocmask(SIG_BLOCK, $sigset); |
$RemoteHost = $host; |
$RemoteHost = $host; |
|
ShowStatus('Parent keeping the flock'); # Update time in status message. |
Log("CRITICAL", "Forking server for ".$host); |
Log("CRITICAL", "Forking server for ".$host); |
my $pid = fork; |
my $pid = fork; |
if($pid) { # Parent |
if($pid) { # Parent |