Skip to content

Commit 6d36e51

Browse files
committed
Log out, but only sometimes
1 parent c3c8136 commit 6d36e51

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

contrib/load-tester/fire_requests.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88

99
import uuid
1010
import sys
11+
import random
1112

1213
from httplib import HTTPConnection
1314

1415
PORT = "2060"
1516

17+
1618
def main(targetIF, prefix, maxI):
1719
target = get_ip_address(targetIF)
1820
for i in xrange(int(maxI)):
@@ -39,14 +41,16 @@ def main(targetIF, prefix, maxI):
3941
resp.read()
4042
except:
4143
pass
42-
conn = HTTPConnection(target, PORT, timeout=10, source_address=(source, 0))
43-
conn.connect()
44-
conn.request("GET", "/wifidog/auth?logout=1&token=" + token)
45-
try:
46-
resp = conn.getresponse()
47-
resp.read()
48-
except:
49-
pass
44+
# log out sometimes
45+
if random.choice([True, False, False]):
46+
conn = HTTPConnection(target, PORT, timeout=10, source_address=(source, 0))
47+
conn.connect()
48+
conn.request("GET", "/wifidog/auth?logout=1&token=" + token)
49+
try:
50+
resp = conn.getresponse()
51+
resp.read()
52+
except:
53+
pass
5054

5155

5256
# http://code.activestate.com/recipes/439094-get-the-ip-address-associated-with-a-network-inter/

0 commit comments

Comments
 (0)