[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /auth lonacc.pm

raeburn raeburn at source.lon-capa.org
Sat Jan 21 15:40:46 EST 2017


raeburn		Sat Jan 21 20:40:46 2017 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/auth	lonacc.pm 
  Log:
  - For 2.11
    - Backport 1.165
  
  
Index: loncom/auth/lonacc.pm
diff -u loncom/auth/lonacc.pm:1.159.2.4 loncom/auth/lonacc.pm:1.159.2.5
--- loncom/auth/lonacc.pm:1.159.2.4	Tue Aug 16 20:36:45 2016
+++ loncom/auth/lonacc.pm	Sat Jan 21 20:40:46 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Cookie Based Access Handler
 #
-# $Id: lonacc.pm,v 1.159.2.4 2016/08/16 20:36:45 raeburn Exp $
+# $Id: lonacc.pm,v 1.159.2.5 2017/01/21 20:40:46 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -331,10 +331,24 @@
         }
         unless ($hosthere) {
             ($is_balancer,$otherserver) =
-                &Apache::lonnet::check_loadbalancing($user,$domain);
+                &Apache::lonnet::check_loadbalancing($user,$domain,'login');
+            if ($is_balancer) {
+                if ($otherserver eq '') {
+                    my $lowest_load;
+                    ($otherserver,undef,undef,undef,$lowest_load) = &Apache::lonnet::choose_server($domain);
+                    if ($lowest_load > 100) {
+                        $otherserver = &Apache::lonnet::spareserver($lowest_load,$lowest_load,1,$domain);
+                    }
+                }
+                if ($otherserver ne '') {
+                    my @hosts = &Apache::lonnet::current_machine_ids();
+                    if (grep(/^\Q$otherserver\E$/, at hosts)) {
+                        $hosthere = $otherserver;
+                    }
+                }
+            }
         }
-
-	if ($is_balancer) {
+	if (($is_balancer) && (!$hosthere)) {
 	    # login but immediately go to switch server to find us a new 
 	    # machine
 	    &Apache::lonauth::success($r,$user,$domain,$home,'noredirect');
@@ -376,6 +390,9 @@
                 $info{'sso.reloginserver'} = 
                     $r->dir_config('lonSSOReloginServer'); 
             }
+            if (($is_balancer) && ($hosthere)) {
+                $info{'noloadbalance'} = $hosthere;
+            }
 	    my $token = 
 		&Apache::lonnet::tmpput(\%info,
 					$r->dir_config('lonHostID'));




More information about the LON-CAPA-cvs mailing list