[LON-CAPA-cvs] cvs: loncom / lond /lonnet/perl lonnet.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Wed, 04 Apr 2007 00:48:24 -0000
albertel Tue Apr 3 20:48:24 2007 EDT
Modified files:
/loncom lond
/loncom/lonnet/perl lonnet.pm
Log:
- can explicitly flush the cached host info
- logic on which children to kill was backwards
Index: loncom/lond
diff -u loncom/lond:1.370 loncom/lond:1.371
--- loncom/lond:1.370 Tue Apr 3 20:03:40 2007
+++ loncom/lond Tue Apr 3 20:48:13 2007
@@ -2,7 +2,7 @@
# The LearningOnline Network
# lond "LON Daemon" Server (port "LOND" 5663)
#
-# $Id: lond,v 1.370 2007/04/04 00:03:40 albertel Exp $
+# $Id: lond,v 1.371 2007/04/04 00:48:13 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -59,7 +59,7 @@
my $status='';
my $lastlog='';
-my $VERSION='$Revision: 1.370 $'; #' stupid emacs
+my $VERSION='$Revision: 1.371 $'; #' stupid emacs
my $remoteVERSION;
my $currenthostid="default";
my $currentdomainid;
@@ -5048,12 +5048,11 @@
# either dropped or changed hosts. Note that the re-read of the table
# will take care of new and changed hosts as connections come into being.
- #FIXME need a way to tell lonnet that it needs to reset host
- #cached host info
+ &Apache::lonnet::reset_hosts_info();
foreach my $child (keys(%children)) {
my $childip = $children{$child};
- if (defined(&Apache::lonnet::get_hosts_from_ip($childip))) {
+ if (!defined(&Apache::lonnet::get_hosts_from_ip($childip))) {
logthis('<font color="blue"> UpdateHosts killing child '
." $child for ip $childip </font>");
kill('INT', $child);
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.863 loncom/lonnet/perl/lonnet.pm:1.864
--- loncom/lonnet/perl/lonnet.pm:1.863 Tue Apr 3 20:10:15 2007
+++ loncom/lonnet/perl/lonnet.pm Tue Apr 3 20:48:23 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.863 2007/04/04 00:10:15 albertel Exp $
+# $Id: lonnet.pm,v 1.864 2007/04/04 00:48:23 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -7685,7 +7685,12 @@
$domain{$name} = \%this_domain;
}
}
-
+
+ sub reset_domain_info {
+ undef($loaded);
+ undef(%domain);
+ }
+
sub load_domain_tab {
&get_dns('/adm/dns/domain',\&parse_domain_tab);
my $fh;
@@ -7733,6 +7738,15 @@
}
}
}
+
+ sub reset_hosts_info {
+ &reset_domain_info();
+ &reset_hosts_ip_info();
+ undef(%hostname);
+ undef(%hostdom);
+ undef(%libserv);
+ undef($loaded);
+ }
sub load_hosts_tab {
&get_dns('/adm/dns/hosts',\&parse_hosts_tab);
@@ -7819,6 +7833,12 @@
}
return;
}
+
+ sub reset_hosts_ip_info {
+ undef(%iphost);
+ undef(%name_to_ip);
+ undef(%lonid_to_ip);
+ }
sub get_host_ip {
my ($lonid) = @_;
@@ -7838,7 +7858,7 @@
if (%iphost) { return %iphost; }
my %hostname = &all_hostnames();
foreach my $id (keys(%hostname)) {
- my $name=$hostname{$id};
+ my $name=&hostname($id);
my $ip;
if (!exists($name_to_ip{$name})) {
$ip = gethostbyname($name);