Permalink
Browse files

validate number of connections and number of concurrent connections

  • Loading branch information...
cosmin committed Jan 10, 2013
1 parent 216f3ea commit 3c98561f539585e5d1996138a8deb03367bf8804
Showing with 9 additions and 1 deletion.
  1. +9 −1 beeswithmachineguns/bees.py
@@ -269,7 +269,7 @@ def _print_results(results):
print 'Mission Assessment: Target severely compromised.'
else:
print 'Mission Assessment: Swarm annihilated target.'
-
+
def attack(url, n, c):
"""
Test the root url of this site.
@@ -294,6 +294,14 @@ def attack(url, n, c):
instances.extend(reservation.instances)
instance_count = len(instances)
+
+ if n < instance_count * 2:
+ print 'bees: error: the total number of requests must be at least %d (2x num. instances)' % (instance_count * 2)
+ return
+ if c < instance_count:
+ print 'bees: error: the number of concurrent requests must be at least %d (num. instances)' % instance_count
+ return
+
requests_per_instance = int(float(n) / instance_count)
connections_per_instance = int(float(c) / instance_count)

0 comments on commit 3c98561

Please sign in to comment.