--- loncom/auth/lonauth.pm 2011/06/12 14:18:09 1.115 +++ loncom/auth/lonauth.pm 2011/08/17 03:52:36 1.118 @@ -1,7 +1,7 @@ # The LearningOnline Network # User Authentication Module # -# $Id: lonauth.pm,v 1.115 2011/06/12 14:18:09 raeburn Exp $ +# $Id: lonauth.pm,v 1.118 2011/08/17 03:52:36 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -415,10 +415,12 @@ sub handler { } } - if ($r->dir_config("lonBalancer") eq 'yes') { - my $otherserver = &Apache::lonnet::spareserver(30000,undef,1,$form{'udom'}); + my ($is_balancer,$otherserver) = + &Apache::lonnet::check_loadbalancing($form{'uname'},$form{'udom'}); + + if ($is_balancer) { if (!$otherserver) { - $otherserver = &Apache::lonnet::choose_server($form{'udom'}); + ($otherserver) = &Apache::lonnet::choose_server($form{'udom'}); } if ($otherserver) { &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef, @@ -430,7 +432,7 @@ sub handler { return OK; } else { if (!&check_can_host($r,\%form,$authhost)) { - my $otherserver = &Apache::lonnet::choose_server($form{'udom'}); + my ($otherserver) = &Apache::lonnet::choose_server($form{'udom'}); if ($otherserver) { &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef, \%form); @@ -458,7 +460,7 @@ sub handler { if ((($userloadpercent>100.0)||($loadpercent>100.0))) { my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent,1,$form{'udom'}); if (!$unloaded) { - $unloaded = &Apache::lonnet::choose_server($form{'udom'}); + ($unloaded) = &Apache::lonnet::choose_server($form{'udom'}); } if ($unloaded) { &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',