Diff for /loncom/lonnet/perl/lonnet.pm between versions 1.888 and 1.892

version 1.888, 2007/06/13 01:43:54 version 1.892, 2007/06/18 22:52:33
Line 149  sub create_connection { Line 149  sub create_connection {
      Type    => SOCK_STREAM,       Type    => SOCK_STREAM,
      Timeout => 10);       Timeout => 10);
     return 0 if (!$client);      return 0 if (!$client);
     print $client (join(':',$hostname,$lonid,&machine_ids($lonid))."\n");      print $client (join(':',$hostname,$lonid,&machine_ids($hostname))."\n");
     my $result = <$client>;      my $result = <$client>;
     chomp($result);      chomp($result);
     return 1 if ($result eq 'done');      return 1 if ($result eq 'done');
Line 214  sub reply { Line 214  sub reply {
 # ----------------------------------------------------------- Send USR1 to lonc  # ----------------------------------------------------------- Send USR1 to lonc
   
 sub reconlonc {  sub reconlonc {
       my ($lonid) = @_;
       my $hostname = &hostname($lonid);
       if ($lonid) {
    my $peerfile="$perlvar{'lonSockDir'}/$hostname";
    if ($hostname && -e $peerfile) {
       &logthis("Trying to reconnect lonc for $lonid ($hostname)");
       my $client=IO::Socket::UNIX->new(Peer    => $peerfile,
        Type    => SOCK_STREAM,
        Timeout => 10);
       if ($client) {
    print $client ("reset_retries\n");
    my $answer=<$client>;
    #reset just this one.
       }
    }
    return;
       }
   
     &logthis("Trying to reconnect lonc");      &logthis("Trying to reconnect lonc");
     my $loncfile="$perlvar{'lonDaemons'}/logs/lonc.pid";      my $loncfile="$perlvar{'lonDaemons'}/logs/lonc.pid";
     if (open(my $fh,"<$loncfile")) {      if (open(my $fh,"<$loncfile")) {
Line 7601  sub machine_ids { Line 7619  sub machine_ids {
     $hostname ||= &hostname($perlvar{'lonHostID'});      $hostname ||= &hostname($perlvar{'lonHostID'});
     my @ids;      my @ids;
     my %name_to_host = &all_names();      my %name_to_host = &all_names();
     return @{ $name_to_host{$hostname} };      if (ref($name_to_host{$hostname}) eq 'ARRAY') {
    return @{ $name_to_host{$hostname} };
       }
       return;
 }  }
   
 sub additional_machine_domains {  sub additional_machine_domains {
Line 7714  sub correct_line_ends { Line 7735  sub correct_line_ends {
   
 sub goodbye {  sub goodbye {
    &logthis("Starting Shut down");     &logthis("Starting Shut down");
     &logthis("test");  
 #not converted to using infrastruture and probably shouldn't be  #not converted to using infrastruture and probably shouldn't be
    &logthis(sprintf("%-20s is %s",'%badServerCache',length(&nfreeze(\%badServerCache))));     &logthis(sprintf("%-20s is %s",'%badServerCache',length(&nfreeze(\%badServerCache))));
 #converted  #converted
Line 7852  sub get_dns { Line 7872  sub get_dns {
     sub reset_hosts_info {      sub reset_hosts_info {
  &reset_domain_info();   &reset_domain_info();
  &reset_hosts_ip_info();   &reset_hosts_ip_info();
    undef(%name_to_host);
  undef(%hostname);   undef(%hostname);
  undef(%hostdom);   undef(%hostdom);
  undef(%libserv);   undef(%libserv);
Line 7943  sub get_dns { Line 7964  sub get_dns {
     my %name_to_ip;      my %name_to_ip;
     my %lonid_to_ip;      my %lonid_to_ip;
   
     my %valid_ip;  
     sub valid_ip {  
  my ($ip) = @_;  
  if (exists($iphost{$ip}) || exists($valid_ip{$ip})) {  
     return 1;  
  }  
  my $name = gethostbyip($ip);  
  my $lonid = &hostname($name);  
  if (defined($lonid)) {  
     $valid_ip{$ip} = $lonid;  
     return 1;  
  }  
  my %iphosts = &get_iphost();  
  if (ref($iphost{$ip})) {  
     return 1;  
  }  
     }  
   
     sub get_hosts_from_ip {      sub get_hosts_from_ip {
  my ($ip) = @_;   my ($ip) = @_;
  my %iphosts = &get_iphost();   my %iphosts = &get_iphost();

Removed from v.1.888  
changed lines
  Added in v.1.892


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