version 1.24, 2002/02/06 14:13:19
|
version 1.25, 2002/02/06 14:15:37
|
Line 570 while (1) {
|
Line 570 while (1) {
|
|
|
# Any complete requests to process? |
# Any complete requests to process? |
foreach $client (keys %ready) { |
foreach $client (keys %ready) { |
handle($client,$conserver); |
handle($client); |
} |
} |
|
|
# Buffers to flush? |
# Buffers to flush? |
foreach $client ($select->can_write(1)) { |
foreach $client ($select->can_write(1)) { |
# Skip this client if we have nothing to say |
# Skip this client if we have nothing to say |
next unless exists $outbuffer{$client}; |
next unless exists $outbuffer{$client}; |
|
|
$rv = $client->send($outbuffer{$client}, 0); |
$rv = $client->send($outbuffer{$client}, 0); |
unless (defined $rv) { |
unless (defined $rv) { |
# Whine, but move on. |
# Whine, but move on. |
Line 606 while (1) {
|
Line 607 while (1) {
|
} |
} |
} |
} |
} |
} |
} |
|
# ------------------------------------------------------- End of make_new_child |
# ------------------------------------------------------- End of make_new_child |
|
|
# handle($socket) deals with all pending requests for $client |
# handle($socket) deals with all pending requests for $client |
Line 614 sub handle {
|
Line 615 sub handle {
|
# requests are in $ready{$client} |
# requests are in $ready{$client} |
# send output to $outbuffer{$client} |
# send output to $outbuffer{$client} |
my $client = shift; |
my $client = shift; |
my $conserver = shift; |
|
my $request; |
my $request; |
|
|
foreach $request (@{$ready{$client}}) { |
foreach $request (@{$ready{$client}}) { |
Line 641 sub handle {
|
Line 641 sub handle {
|
eval { |
eval { |
alarm(300); |
alarm(300); |
&status("Sending $conserver: $request"); |
&status("Sending $conserver: $request"); |
&logthis("Sending $conserver: $request"); |
|
print $remotesock "$request"; |
print $remotesock "$request"; |
&status("Waiting for reply from $conserver: $request"); |
&status("Waiting for reply from $conserver: $request"); |
&logthis("Waiting for reply from $conserver: $request"); |
|
$answer=<$remotesock>; |
$answer=<$remotesock>; |
&status("Received reply: $request"); |
&status("Received reply: $request"); |
&logthis("Received reply $conserver: $answer"); |
|
alarm(0); |
alarm(0); |
}; |
}; |
if ($@=~/timeout/) { |
if ($@=~/timeout/) { |
Line 678 sub handle {
|
Line 675 sub handle {
|
} |
} |
|
|
# ===================================================== Done processing request |
# ===================================================== Done processing request |
&logthis("Completed $conserver: $request"); |
|
} |
} |
delete $ready{$client}; |
delete $ready{$client}; |
&status("Completed $conserver: $request"); |
&status("Completed $conserver: $request"); |
# -------------------------------------------------------------- End non-forker |
# -------------------------------------------------------------- End non-forker |
} |
} |
# ---------------------------------------------------------- End make_new_child |
# ---------------------------------------------------------- End make_new_child |
|
} |
|
|
# nonblock($socket) puts socket into nonblocking mode |
# nonblock($socket) puts socket into nonblocking mode |
sub nonblock { |
sub nonblock { |