Diff for /loncom/Attic/lonc between versions 1.51 and 1.56

version 1.51, 2003/07/23 16:52:30 version 1.56, 2003/10/24 16:36:14
Line 124  close(CONFIG); Line 124  close(CONFIG);
 %childatt               = ();       # number of attempts to start server  %childatt               = ();       # number of attempts to start server
                                     # for ID                                      # for ID
   
 $childmaxattempts=5;  $childmaxattempts=15;
   
 # ---------------------------------------------------- Fork once and dissociate  # ---------------------------------------------------- Fork once and dissociate
 &status("Fork and dissociate");  &status("Fork and dissociate");
Line 361  while (1) { Line 361  while (1) {
  # accept a new connection   # accept a new connection
  &status("Accept new connection: $conserver");   &status("Accept new connection: $conserver");
  $client = $server->accept();   $client = $server->accept();
  if($DEBUG) {   if (!$client) {
     &logthis("New client fd = ".$client->fileno."\n");      &logthis("Got stupid nonexisent client on ".$server->fileno." $conserver \n");
    } else {
       if($DEBUG) {
    &logthis("New client fd = ".$client->fileno."\n");
       }
       $servers{$client->fileno} = $client;
       nonblock($client);
       $client->sockopt(SO_KEEPALIVE, 1); # Enable monitoring of
                                          # connection liveness.
  }   }
  $servers{$client->fileno} = $client;  
  nonblock($client);  
  $client->sockopt(SO_KEEPALIVE, 1);# Enable monitoring of  
                                   # connection liveness.  
     }      }
     HandleInput($infdset, \%servers, \%inbuffer, \%outbuffer, \%ready);      HandleInput($infdset, \%servers, \%inbuffer, \%outbuffer, \%ready);
     HandleOutput($outfdset, \%servers, \%outbuffer, \%inbuffer,      HandleOutput($outfdset, \%servers, \%outbuffer, \%inbuffer,
Line 638  sub handle { Line 642  sub handle {
             $request="enc:$cmdlength:$encrequest";              $request="enc:$cmdlength:$encrequest";
         }          }
 # --------------------------------------------------------------- Main exchange  # --------------------------------------------------------------- Main exchange
  $answer = londtransaction($remotesock, $request, 300);   $answer = londtransaction($remotesock, $request, 60);
   
  if($DEBUG) {    if($DEBUG) { 
     &logthis("<font color=green> Request data exchange complete");      &logthis("<font color=green> Request data exchange complete");
Line 707  sub openremote { Line 711  sub openremote {
     my $st=120+int(rand(240)); # Sleep before opening:      my $st=120+int(rand(240)); # Sleep before opening:
   
     unless (      unless (
     $remotesock = IO::Socket::INET->new(PeerAddr => $hostip{$conserver},      $remotesock = IO::Socket::INET->new(PeerAddr => $hostname{$conserver},
  PeerPort => $perlvar{'londPort'},   PeerPort => $perlvar{'londPort'},
  Proto    => "tcp",   Proto    => "tcp",
  Type     => SOCK_STREAM)   Type     => SOCK_STREAM)
Line 759  sub openremote { Line 763  sub openremote {
   
     sleep 5;      sleep 5;
     &status("Ponging $conserver");      &status("Ponging $conserver");
     print $remotesock "pong\n";      $answer= londtransaction($remotesock,"pong",60);
     $answer=<$remotesock>;  
     chomp($answer);      chomp($answer);
     if ($answer!~/^$conserver/) {      if ($answer!~/^$conserver/) {
  &logthis("Pong reply: >$answer<");   &logthis("Pong reply: >$answer<");
Line 768  sub openremote { Line 771  sub openremote {
 # ----------------------------------------------------------- Initialize cipher  # ----------------------------------------------------------- Initialize cipher
   
     &status("Initialize cipher");      &status("Initialize cipher");
     print $remotesock "ekey\n";      my $buildkey=londtransaction($remotesock,"ekey",60);
     my $buildkey=<$remotesock>;  
     my $key=$conserver.$perlvar{'lonHostID'};      my $key=$conserver.$perlvar{'lonHostID'};
     $key=~tr/a-z/A-Z/;      $key=~tr/a-z/A-Z/;
     $key=~tr/G-P/0-9/;      $key=~tr/G-P/0-9/;
Line 990  sub londtransaction { Line 992  sub londtransaction {
     alarm(0);      alarm(0);
  };   };
     } else {      } else {
  &logthis("lonc - suiciding on send Timeout");   &logthis("lonc - $conserver - suiciding on send Timeout");
  die("lonc - suiciding on send Timeout");   die("lonc - $conserver - suiciding on send Timeout");
     }      }
     if ($@ =~ /timeout/) {      if ($@ =~ /timeout/) {
  &logthis("lonc - suiciding on read Timeout");   &logthis("lonc - $conserver - suiciding on read Timeout");
  die("lonc - suiciding on read Timeout");   die("lonc - $conserver - suiciding on read Timeout");
     }      }
     #      #
     # Restore the initial sigmask set.      # Restore the initial sigmask set.
Line 1151  Learner B<H> solves a problem on server Line 1153  Learner B<H> solves a problem on server
 B<H>'s Home Server, so this information gets forwarded to B<E>, where  B<H>'s Home Server, so this information gets forwarded to B<E>, where
 the records of H are updated.  the records of H are updated.
   
 =head2 lond, lonc, lonnet  =head2 lond, lonc, and lonnet
   
 =begin latex  =begin latex
   
 \begin{figure}  \begin{figure}
 \includegraphics[width=0.75\paperwidth,keepaspectratio]{LONCAPA_Network_Diagram2}  \includegraphics[width=0.65\paperwidth,keepaspectratio]{LONCAPA_Network_Diagram2}
   \caption{\label{Overview_Of_Network_Communication}Overview of    \caption{\label{Overview_Of_Network_Communication}Overview of
 Network Communication} \end{figure}  Network Communication} \end{figure}
   
Line 1428  be copied over using the same mechanism Line 1430  be copied over using the same mechanism
 B<D7>, which represents steps Steps B<U4a> through B<U6> in the  B<D7>, which represents steps Steps B<U4a> through B<U6> in the
 replication figure.  replication figure.
   
 =head2 Load Balancing X<load balancing>  =head2 Load Balancing 
   
 C<lond> provides a function to query the server's current loadavg. As  X<load balancing>C<lond> provides a function to query the server's current loadavg. As
 a configuration parameter, one can determine the value of loadavg,  a configuration parameter, one can determine the value of loadavg,
 which is to be considered 100%, for example, 2.00.  which is to be considered 100%, for example, 2.00.
   

Removed from v.1.51  
changed lines
  Added in v.1.56


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>