From d49b7666e6232c8624af14a1f946e7acfde25d9f Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Fri, 29 Mar 2024 03:02:33 +0100 Subject: [PATCH] Chore: Fix probe_tcp_connect, by adding a low timeout --- pytest_mqtt/util.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pytest_mqtt/util.py b/pytest_mqtt/util.py index dd9d856..005f62e 100644 --- a/pytest_mqtt/util.py +++ b/pytest_mqtt/util.py @@ -15,6 +15,7 @@ def probe_tcp_connect(host: str, port: int) -> bool: https://github.com/lovelysystems/lovely.testlayers/blob/0.7.0/src/lovely/testlayers/util.py#L6-L13 """ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.settimeout(0.1) ex = s.connect_ex((host, port)) if ex == 0: s.close()