Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: X2Go dev team <git-admin-P0WSJaAXTow <at> public.gmane.org>
Subject: x2gobroker.git - master (branch) updated: 0.0.0.1-44-g6267590
Newsgroups: gmane.linux.terminal-server.x2go.scm
Date: Wednesday 20th February 2013 22:41:42 UTC (over 3 years ago)
The branch, master has been updated
       via  62675904dff3890b3cd24cc9d819d4040bd38530 (commit)
      from  7009b45598b63ddc76192f7fc87bc9a80b15e8bc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 62675904dff3890b3cd24cc9d819d4040bd38530
Author: Mike Gabriel

Date:   Wed Feb 20 23:44:32 2013 +0100

    simplyfy findbusyservers mode in broker agent

-----------------------------------------------------------------------

Summary of changes:
 lib/x2gobroker-agent.pl |   22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

The diff of changes is:
diff --git a/lib/x2gobroker-agent.pl b/lib/x2gobroker-agent.pl
index 481de06..3155837 100755
--- a/lib/x2gobroker-agent.pl
+++ b/lib/x2gobroker-agent.pl
@@ -121,36 +121,28 @@ if( ($mode eq 'findbusyservers_by_sessionstats') ||
($mode eq 'findbusyservers')
 
 	InitX2GoUser($uid, $uidNumber, $gidNumber, $home);
 	print "OK\n";
-	my $session_list = `/bin/su - -c \"x2golistsessions_root
--all-servers\"`;
 	my $busy_servers = `/bin/su - $uid -c \"x2gogetservers\"`;
-	my $amount_sessions = 0;
 
-	# initialize server_load hash
 	my %server_load = ();
+	my $num_sessions = 0;
 	foreach (split('\n', $busy_servers))
 	{
-		$server_load{$_} = 0;
-	}
-
-	# count sessions per server
-	my @session_list = split(/\n/, $session_list);
-	foreach (@session_list)
-	{
-		my ($apid, $sid, $disp, $hostname, $stat, $dcreated, $cookie, $gport,
$sndport, $dsusp, $username, $fsport) = split('\\|', $_);
-		$amount_sessions++;
-		$server_load{$hostname} += 1;
+		my ($hostname, $num_users) = split(' ', $_);
+		$server_load{$hostname} = $num_users;
+		$num_sessions += $num_users;
 	}
 
 	# render the output result
 	my @result;
 	for my $hostname ( keys %server_load ) {
-		my $available = $server_load{$hostname}/$amount_sessions*100;
+		my $available = $server_load{$hostname}/$num_sessions*100;
 		push @result, sprintf '%1$d:%2$s', $available, $hostname;
 	}
-	print join('\n', sort @result);
+	print join("\n", sort @result);
 	print "\n";
 }
 
+
 if($mode eq 'getservers')
 {
 	InitX2GoUser($uid, $uidNumber, $gidNumber, $home);


hooks/post-receive
 
CD: 4ms