[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

raeburn raeburn at source.lon-capa.org
Wed Aug 23 18:46:39 EDT 2017


raeburn		Wed Aug 23 22:46:39 2017 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Where there is a discrepancy in the hostname for a lonHostID between 
    the record retrieved from get_dns() and the record from hosts.tab, the
    latter takes precedence.
  - Eliminate duplicates in array returned by &current_machine_ids()
    since a record for current server's lonHostID is expected to be in both 
    dns_hosts.tab and hosts.tab.
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1350 loncom/lonnet/perl/lonnet.pm:1.1351
--- loncom/lonnet/perl/lonnet.pm:1.1350	Wed Aug 23 22:38:43 2017
+++ loncom/lonnet/perl/lonnet.pm	Wed Aug 23 22:46:38 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1350 2017/08/23 22:38:43 raeburn Exp $
+# $Id: lonnet.pm,v 1.1351 2017/08/23 22:46:38 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -13363,8 +13363,23 @@
 	    my ($id,$domain,$role,$name,$protocol,$intdom)=split(/:/,$configline);
 	    $name=~s/\s//g;
 	    if ($id && $domain && $role && $name) {
+                if ((exists($hostname{$id})) && ($hostname{$id} ne '')) {
+                    my $curr = $hostname{$id};
+                    my $skip;
+                    if (ref($name_to_host{$curr}) eq 'ARRAY') {
+                        if (($curr eq $name) && (@{$name_to_host{$curr}} == 1)) {
+                            $skip = 1;
+                        } else {
+                            @{$name_to_host{$curr}} = grep { $_ ne $id } @{$name_to_host{$curr}};
+                        }
+                    }
+                    unless ($skip) {
+                        push(@{$name_to_host{$name}},$id);
+                    }
+                } else {
+                    push(@{$name_to_host{$name}},$id);
+                }
 		$hostname{$id}=$name;
-		push(@{$name_to_host{$name}}, $id);
 		$hostdom{$id}=$domain;
 		if ($role eq 'library') { $libserv{$id}=$name; }
                 if (defined($protocol)) {




More information about the LON-CAPA-cvs mailing list