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

raeburn raeburn@source.lon-capa.org
Fri, 04 Mar 2011 02:06:37 -0000


raeburn		Fri Mar  4 02:06:37 2011 EDT

  Modified files:              (Branch: version_2_10_X)
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Backport remainder of 1.1083 ommitted from earlier backport (1.1056.4.8).
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1056.4.22 loncom/lonnet/perl/lonnet.pm:1.1056.4.23
--- loncom/lonnet/perl/lonnet.pm:1.1056.4.22	Fri Mar  4 02:02:37 2011
+++ loncom/lonnet/perl/lonnet.pm	Fri Mar  4 02:06:36 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1056.4.22 2011/03/04 02:02:37 raeburn Exp $
+# $Id: lonnet.pm,v 1.1056.4.23 2011/03/04 02:06:36 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -752,22 +752,22 @@
 # ------------------------------ Find server with least workload from spare.tab
 
 sub spareserver {
-    my ($loadpercent,$userloadpercent,$want_server_name) = @_;
+    my ($loadpercent,$userloadpercent,$want_server_name,$udom) = @_;
     my $spare_server;
     if ($userloadpercent !~ /\d/) { $userloadpercent=0; }
     my $lowest_load=($loadpercent > $userloadpercent) ? $loadpercent 
                                                      :  $userloadpercent;
     my ($uint_dom,$remotesessions);
-    if ($env{'user.domain'}) {
-        my $uprimary_id = &Apache::lonnet::domain($env{'user.domain'},'primary');
+    if (($udom ne '') && (&domain($udom) ne '')) {
+        my $uprimary_id = &Apache::lonnet::domain($udom,'primary');
         $uint_dom = &Apache::lonnet::internet_dom($uprimary_id);
-        my %udomdefaults = &Apache::lonnet::get_domain_defaults($env{'user.domain'});
+        my %udomdefaults = &Apache::lonnet::get_domain_defaults($udom);
         $remotesessions = $udomdefaults{'remotesessions'};
     }
     foreach my $try_server (@{ $spareid{'primary'} }) {
         if ($uint_dom) {
-            next unless (&spare_can_host($env{'user.domain'},$uint_dom,
-                                         $remotesessions,$try_server));
+            next unless (&spare_can_host($udom,$uint_dom,$remotesessions,
+                                         $try_server));
         }
 	($spare_server, $lowest_load) =
 	    &compare_server_load($try_server, $spare_server, $lowest_load);
@@ -778,8 +778,8 @@
     if (!$found_server) {
 	foreach my $try_server (@{ $spareid{'default'} }) {
             if ($uint_dom) {
-                next unless (&spare_can_host($env{'user.domain'},$uint_dom,
-                                             $remotesessions,$try_server));
+                next unless (&spare_can_host($udom,$uint_dom,$remotesessions,
+                                             $try_server));
             }
 	    ($spare_server, $lowest_load) =
 		&compare_server_load($try_server, $spare_server, $lowest_load);