--- loncom/Attic/lonc 2002/02/06 14:13:19 1.24 +++ loncom/Attic/lonc 2002/02/06 14:15:37 1.25 @@ -5,7 +5,7 @@ # provides persistent TCP connections to the other servers in the network # through multiplexed domain sockets # -# $Id: lonc,v 1.24 2002/02/06 14:13:19 albertel Exp $ +# $Id: lonc,v 1.25 2002/02/06 14:15:37 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -570,13 +570,14 @@ while (1) { # Any complete requests to process? foreach $client (keys %ready) { - handle($client,$conserver); + handle($client); } # Buffers to flush? foreach $client ($select->can_write(1)) { # Skip this client if we have nothing to say next unless exists $outbuffer{$client}; + $rv = $client->send($outbuffer{$client}, 0); unless (defined $rv) { # Whine, but move on. @@ -606,7 +607,7 @@ while (1) { } } } -} + # ------------------------------------------------------- End of make_new_child # handle($socket) deals with all pending requests for $client @@ -614,7 +615,6 @@ sub handle { # requests are in $ready{$client} # send output to $outbuffer{$client} my $client = shift; - my $conserver = shift; my $request; foreach $request (@{$ready{$client}}) { @@ -641,13 +641,10 @@ sub handle { eval { alarm(300); &status("Sending $conserver: $request"); - &logthis("Sending $conserver: $request"); print $remotesock "$request"; &status("Waiting for reply from $conserver: $request"); - &logthis("Waiting for reply from $conserver: $request"); $answer=<$remotesock>; &status("Received reply: $request"); - &logthis("Received reply $conserver: $answer"); alarm(0); }; if ($@=~/timeout/) { @@ -678,13 +675,13 @@ sub handle { } # ===================================================== Done processing request - &logthis("Completed $conserver: $request"); } delete $ready{$client}; &status("Completed $conserver: $request"); # -------------------------------------------------------------- End non-forker } # ---------------------------------------------------------- End make_new_child +} # nonblock($socket) puts socket into nonblocking mode sub nonblock {