From 8165af3ef1e68001f67202f76149e3a303c34925 Mon Sep 17 00:00:00 2001
From: Jan Soukal <soukal@ics.muni.cz>
Date: Mon, 13 Aug 2012 16:49:59 +0200
Subject: [PATCH] task #504: pridana podporacteni MAX_RCV_EVENTS_LIMIT z
 konfiguraku a predani pri stahovani ze serveru

---
 src/warden-client/etc/warden-client.conf     | 6 ++++++
 src/warden-client/lib/WardenClientConf.pm    | 3 ++-
 src/warden-client/lib/WardenClientReceive.pm | 7 ++++---
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/warden-client/etc/warden-client.conf b/src/warden-client/etc/warden-client.conf
index 276b8ed..250782c 100644
--- a/src/warden-client/etc/warden-client.conf
+++ b/src/warden-client/etc/warden-client.conf
@@ -22,3 +22,9 @@ $SSL_CERT_FILE = "/opt/warden-client/etc/warden-dev.cesnet.cz.pem";
 #-------------------------------------------------------------------------------
 $SSL_CA_FILE = "/etc/ssl/certs/tcs-ca-bundle.pem";
 
+#-------------------------------------------------------------------------------
+# MAX_RCV_EVENTS_LIMIT - maximum number of events the client is allowd to get
+#                        from the Warden server in one batch
+#-------------------------------------------------------------------------------
+$MAX_RCV_EVENTS_LIMIT = 10000;
+
diff --git a/src/warden-client/lib/WardenClientConf.pm b/src/warden-client/lib/WardenClientConf.pm
index 637e046..c185aea 100755
--- a/src/warden-client/lib/WardenClientConf.pm
+++ b/src/warden-client/lib/WardenClientConf.pm
@@ -24,6 +24,7 @@ sub loadConf
   our $SSL_KEY_FILE = undef;
   our $SSL_CERT_FILE = undef;
   our $SSL_CA_FILE = undef;
+  our $MAX_RCV_EVENTS_LIMIT = undef;
 
   # read config file
   if ( ! open( TMP, $conf_file) ) {
@@ -36,7 +37,7 @@ sub loadConf
     die("Errors in config file '$conf_file': $@");
   }
 
-  return ($URI, $SSL_KEY_FILE, $SSL_CERT_FILE, $SSL_CA_FILE);
+  return ($URI, $SSL_KEY_FILE, $SSL_CERT_FILE, $SSL_CA_FILE, $MAX_RCV_EVENTS_LIMIT);
 
 } # End of loadConf
 1;
diff --git a/src/warden-client/lib/WardenClientReceive.pm b/src/warden-client/lib/WardenClientReceive.pm
index 92e9537..437e9b5 100755
--- a/src/warden-client/lib/WardenClientReceive.pm
+++ b/src/warden-client/lib/WardenClientReceive.pm
@@ -91,7 +91,7 @@ sub getNewEvents
   # read the config file
   require $libdir .  "WardenClientConf.pm";
   my $conf_file = $etcdir . "warden-client.conf";
-  my ($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file) = WardenClientConf::loadConf($conf_file);
+  my ($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file, $max_rcv_events_limit) = WardenClientConf::loadConf($conf_file);
 
   # set name of ID file for each client aplication 
   my $caller_name = $FindBin::Script;
@@ -121,8 +121,9 @@ sub getNewEvents
   # create SOAP data obejct
   my $request_data = SOAP::Data->name(
     request => \SOAP::Data->value(
-      SOAP::Data->name(REQUESTED_TYPE => $requested_type),
-      SOAP::Data->name(LAST_ID        => $last_id)
+      SOAP::Data->name(REQUESTED_TYPE 		=> $requested_type),
+      SOAP::Data->name(LAST_ID        		=> $last_id),
+      SOAP::Data->name(MAX_RCV_EVENTS_LIMIT 	=> $max_rcv_events_limit)
     )
   );
   
-- 
GitLab