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

raeburn raeburn at source.lon-capa.org
Mon May 5 07:37:08 EDT 2014


raeburn		Mon May  5 11:37:08 2014 EDT

  Modified files:              (Branch: version_2_10_X)
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - For 2.10
    - Backport 1.1259
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1056.4.38 loncom/lonnet/perl/lonnet.pm:1.1056.4.39
--- loncom/lonnet/perl/lonnet.pm:1.1056.4.38	Tue Mar 25 10:39:01 2014
+++ loncom/lonnet/perl/lonnet.pm	Mon May  5 11:37:07 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1056.4.38 2014/03/25 10:39:01 raeburn Exp $
+# $Id: lonnet.pm,v 1.1056.4.39 2014/05/05 11:37:07 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -888,12 +888,29 @@
 # --------- determine least loaded server in a user's domain which allows login
 
 sub choose_server {
-    my ($udom,$checkloginvia,$required) = @_;
+    my ($udom,$checkloginvia,$required,$notloadbal) = @_;
     my %domconfhash = &Apache::loncommon::get_domainconf($udom);
     my %servers = &get_servers($udom);
     my $lowest_load = 30000;
-    my ($login_host,$hostname,$portal_path,$isredirect);
+    my ($login_host,$hostname,$portal_path,$isredirect,$balancers);
+    if ($notloadbal) {
+        ($balancers,my $cached)=&is_cached_new('loadbalancing',$udom);
+        unless (defined($cached)) {
+            my $cachetime = 60*60*24;
+            my %domconfig =
+                &Apache::lonnet::get_dom('configuration',['loadbalancing'],$udom);
+            if (ref($domconfig{'loadbalancing'}) eq 'HASH') {
+                $balancers = &do_cache_new('loadbalancing',$udom,$domconfig{'loadbalancing'},
+                                           $cachetime);
+            }
+        }
+    }
     foreach my $lonhost (keys(%servers)) {
+        if ($notloadbal) {
+            if (ref($balancers) eq 'HASH') {
+                next if (exists($balancers->{$lonhost}));
+            }
+        }
         my $loginvia;
         if ($checkloginvia) {
             $loginvia = $domconfhash{$udom.'.login.loginvia_'.$lonhost};




More information about the LON-CAPA-cvs mailing list