Skip to content

Commit 700e80c

Browse files
authored
Merge pull request #303 from Venkat-Kunaparaju/iperf
Add timeout to iperf to prevent connection stalling
2 parents c0546f2 + edf81d9 commit 700e80c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

testTypeIperf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
IPERF_EXE = "iperf3"
2828
IPERF_UDP_OPT = "-u"
2929
IPERF_REV_OPT = "-R"
30+
IPERF_TIMEOUT = 30
3031

3132

3233
class ResultTcp:
@@ -139,7 +140,8 @@ class IperfClient(task.ClientTask):
139140
def _create_task_operation(self) -> TaskOperation:
140141
server_ip = self.get_target_ip()
141142
target_port = self.get_target_port()
142-
cmd = f"{IPERF_EXE} -c {server_ip} -p {target_port} --json -t {self.get_duration()}"
143+
timeout = self.get_duration() + IPERF_TIMEOUT
144+
cmd = f"timeout {timeout} {IPERF_EXE} -c {server_ip} -p {target_port} --json -t {self.get_duration()}"
143145

144146
connect_timeout_ms = int(self.get_duration() * 1.5 * 1000)
145147
cmd += f" --connect-timeout {connect_timeout_ms}"

0 commit comments

Comments
 (0)