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

stredwic lon-capa-cvs@mail.lon-capa.org
Tue, 21 May 2002 15:00:05 -0000


stredwic		Tue May 21 11:00:05 2002 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  See bug report 458.  Reversed default for homeserver to using caching of negative results.
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.229 loncom/lonnet/perl/lonnet.pm:1.230
--- loncom/lonnet/perl/lonnet.pm:1.229	Tue May 21 09:06:07 2002
+++ loncom/lonnet/perl/lonnet.pm	Tue May 21 11:00:05 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.229 2002/05/21 13:06:07 stredwic Exp $
+# $Id: lonnet.pm,v 1.230 2002/05/21 15:00:05 stredwic Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -481,14 +481,14 @@
 # ---------------------- Find the homebase for a user from domain's lib servers
 
 sub homeserver {
-    my ($uname,$udom, $cacheBadFlag)=@_;
+    my ($uname,$udom,$ignoreBadCache)=@_;
     my $index="$uname:$udom";
     if ($homecache{$index}) { 
         return "$homecache{$index}"; 
     }
     my $tryserver;
     foreach $tryserver (keys %libserv) {
-        next if ($cacheBadFlag eq 'true' && 
+        next if ($ignoreBadCache ne 'true' && 
 		 exists($badhomecache{$index}->{$tryserver}));
 	if ($hostdom{$tryserver} eq $udom) {
            my $answer=reply("home:$udom:$uname",$tryserver);
@@ -1881,7 +1881,7 @@
              (defined($desiredhome) ? ' desiredhome = '.$desiredhome :
                                      ' desiredhome not specified'). 
              ' by '.$ENV{'user.name'}.' at '.$ENV{'user.domain'});
-    my $uhome=&homeserver($uname,$udom);
+    my $uhome=&homeserver($uname,$udom,'true');
 # ----------------------------------------------------------------- Create User
     if (($uhome eq 'no_host') && ($umode) && ($upass)) {
         my $unhome='';
@@ -1911,7 +1911,7 @@
 	unless ($reply eq 'ok') {
             return 'error: '.$reply;
         }   
-        $uhome=&homeserver($uname,$udom);
+        $uhome=&homeserver($uname,$udom,'true');
         if (($uhome eq '') || ($uhome eq 'no_host') || ($uhome ne $unhome)) {
 	    return 'error: verify home';
         }
@@ -2018,11 +2018,11 @@
    my $uname=substr($$.time,0,5).unpack("H8",pack("I32",time)).
        unpack("H2",pack("I32",int(rand(255)))).$perlvar{'lonHostID'};
 # ----------------------------------------------- Make sure that does not exist
-   my $uhome=&homeserver($uname,$udom);
+   my $uhome=&homeserver($uname,$udom,'true');
    unless (($uhome eq '') || ($uhome eq 'no_host')) {
        $uname=substr($$.time,0,5).unpack("H8",pack("I32",time)).
         unpack("H2",pack("I32",int(rand(255)))).$perlvar{'lonHostID'};
-       $uhome=&homeserver($uname,$udom);       
+       $uhome=&homeserver($uname,$udom,'true');       
        unless (($uhome eq '') || ($uhome eq 'no_host')) {
            return 'error: unable to generate unique course-ID';
        } 
@@ -2031,7 +2031,7 @@
     my $reply=&reply('encrypt:makeuser:'.$udom.':'.$uname.':none::',
                       $ENV{'user.home'});
     unless ($reply eq 'ok') { return 'error: '.$reply; }
-    $uhome=&homeserver($uname,$udom);
+    $uhome=&homeserver($uname,$udom,'true');
     if (($uhome eq '') || ($uhome eq 'no_host')) { 
 	return 'error: no such course';
     }