Added ability to randomise whether data is POST'd upstream
Added ability to randomise whether data is POST'd upstream

--- a/client-side/config
+++ b/client-side/config
@@ -20,7 +20,7 @@
 MAX_DELAY=5 # What should the maximum delay between requests be?
 
 # Data uploads
-SEND_DATA="y" # Should random data also be sent upstream?
+SEND_DATA="r" # Should random data also be sent upstream? (values - y/n/r) Setting to r gives a 1/2 chance of it being a y
 MAX_UPSTREAM="655360" # Data will be a stream of chars, so 1 = 1 byte, take your upstream speeds into consideration
 RANDOMIZE_US_CHUNKSIZE="y" # Set this to n to use the same size upstream chunks per session
 

--- a/client-side/request_generator.sh
+++ b/client-side/request_generator.sh
@@ -6,6 +6,7 @@
 mydir=`dirname $0`
 
 
+# Load the configuration file
 while getopts "c:" flag
 do
 
@@ -29,10 +30,11 @@
 fi
 
 
-# Load the config
+# read in the config file
 source "$configfile"
 
 
+# Check whether the lockfile exists and exit if so
 [[ -f "$LOCKFILE" ]] && exit;
 
 
@@ -70,6 +72,21 @@
 fi
 
 
+# Has sending data upstream been set to random
+if [[ "$SEND_DATA" == "r" ]]
+then
+	no=$((RANDOM%2))
+
+	if [[ "$no" == "0" ]]
+	then
+		SEND_DATA="y"
+	else
+		SEND_DATA="n"
+	fi
+
+fi
+
+# If we're to send data upstream, are we supposed to be randomising with each request?
 if [[ "$SEND_DATA" == "y" ]] && [[ "$RANDOMIZE_US_CHUNKSIZE" == "n" ]]
 then
 	UPSTREAM_LEN=$((RANDOM%$MAX_UPSTREAM))
@@ -81,6 +98,8 @@
 
 for i in `seq 1 $REQUESTS`
 do
+
+	# Calculate the chunksize if needed
 	if [[ ! "$RANDOMIZE_CHUNKSIZE" == "n" ]]
 	then
 		CHUNKS=$((RANDOM%$MAX_CHUNK_SIZE)) # Chunk size