Diff for /loncom/auth/lonauth.pm between versions 1.107 and 1.109

version 1.107, 2010/07/24 17:42:46 version 1.109, 2010/08/25 16:34:32
Line 40  use Apache::lonmenu(); Line 40  use Apache::lonmenu();
 use Apache::createaccount;  use Apache::createaccount;
 use Fcntl qw(:flock);  use Fcntl qw(:flock);
 use Apache::lonlocal;  use Apache::lonlocal;
   use Apache::File ();
 use HTML::Entities;  use HTML::Entities;
     
 # ------------------------------------------------------------ Successful login  # ------------------------------------------------------------ Successful login
Line 409  sub handler { Line 410  sub handler {
  &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef,   &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef,
  \%form);   \%form);
         my ($otherserver) = &Apache::lonnet::choose_server($form{'udom'});          my ($otherserver) = &Apache::lonnet::choose_server($form{'udom'});
  $r->internal_redirect('/adm/switchserver?otherserver='.$otherserver);   $r->internal_redirect('/adm/switchserver?otherserver='.$otherserver.'&origurl='.$firsturl);
     } else {      } else {
  &success($r,$form{'uname'},$form{'udom'},$authhost,$firsturl,undef,  # ------------------------------------------------------- Do the load balancing
  \%form);  
   # ---------------------------------------------------------- Determine own load
           my $loadlim = $r->dir_config('lonLoadLim');
           my $loadavg;
           {
               my $loadfile=Apache::File->new('/proc/loadavg');
               $loadavg=<$loadfile>;
           }
           $loadavg =~ s/\s.*//g;
           my $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
           my $userloadpercent=&Apache::lonnet::userload();
   
   # ---------------------------------------------------------- Are we overloaded?
           if ((($userloadpercent>100.0)||($loadpercent>100.0))) {
               my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent,1,$form{'udom'});
               if ($unloaded) {
                   &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',
                            undef,\%form);
                   $r->internal_redirect('/adm/switchserver?otherserver='.$unloaded.'&origurl='.$firsturl);
               }
           }
           &success($r,$form{'uname'},$form{'udom'},$authhost,$firsturl,undef,
                    \%form);
     }      }
     return OK;      return OK;
 }  }
Line 423  sub check_can_host { Line 446  sub check_can_host {
     my $canhost = 1;      my $canhost = 1;
     my $lonhost = $r->dir_config('lonHostID');      my $lonhost = $r->dir_config('lonHostID');
     my $udom = $form->{'udom'};      my $udom = $form->{'udom'};
     my @intdoms = &Apache::lonnet::get_internet_names($lonhost);      my @intdoms;
       my $internet_names = &Apache::lonnet::get_internet_names($lonhost);
       if (ref($internet_names) eq 'ARRAY') {
           @intdoms = @{$internet_names};
       }
     my $uprimary_id = &Apache::lonnet::domain($udom,'primary');      my $uprimary_id = &Apache::lonnet::domain($udom,'primary');
     my $uint_dom = &Apache::lonnet::internet_dom($uprimary_id);      my $uint_dom = &Apache::lonnet::internet_dom($uprimary_id);
     unless ($uint_dom ne '' && grep(/^\Q$uint_dom\E$/,@intdoms)) {      unless ($uint_dom ne '' && grep(/^\Q$uint_dom\E$/,@intdoms)) {

Removed from v.1.107  
changed lines
  Added in v.1.109


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