tests: Fix ap_wps_er_http_proto max concurrent requests case
authorJouni Malinen <jouni@qca.qualcomm.com>
Wed, 17 Aug 2016 09:24:59 +0000 (12:24 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 17 Aug 2016 10:37:25 +0000 (13:37 +0300)
Commit 2d6a526ac3885605f34df4037fc79ad330565b23 ('tests: Make
ap_wps_er_http_proto more robust') tried to work around the timeouts
here, but that was not really the best approach since the one second
timeout that was used here for connect() ended up being very close to
the limit even before the kernel change. The longer connect() time is
caused by a sequence where the listen() backlog ignores the connection
instead of accept() followed by close() within the wpa_supplicant ER
HTTP connection handling. The time to retransmit the SYN changed a bit
in the kernel from 1.0 sec to about 1.03 sec. This was enough to push
that over the one second timeout.

Fix this by using a sufficiently long timeout (10 sec) to allow SYN
retransmission to occur to recover from the listen() backlog case.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests/hwsim/test_ap_wps.py

index 6d9989a..fcbbb8c 100644 (file)
@@ -4418,11 +4418,8 @@ RGV2aWNlIEEQSQAGADcqAAEg
     for i in range(20):
         socks[i] = socket.socket(socket.AF_INET, socket.SOCK_STREAM,
                                  socket.IPPROTO_TCP)
-        try:
-            socks[i].connect(addr)
-        except:
-            logger.info("connect %d failed" % i)
-            pass
+        socks[i].settimeout(10)
+        socks[i].connect(addr)
     for i in range(20):
         socks[i].send("GET / HTTP/1.1\r\n\r\n")
     count = 0