We use `SO_REUSEPORT` in these tests so if the old responder is
still around when the next test starts, it is quite likely that
it might get one of the new queries. This is usually fine because
responders with a different behaviour listen on different ports,
but if a query is queued to an old responder socket right during
the time that responder is checking whether it should stop and
the actual exit, the query will be lost.
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
sock.bind(("127.0.0.1", port))
- sock.settimeout(1.0)
+ sock.settimeout(0.5)
while True:
try:
data, addr = sock.recvfrom(4096)
sys.exit(1)
sock.listen(100)
- sock.settimeout(1.0)
+ sock.settimeout(0.5)
if tlsContext:
sock = tlsContext.wrap_socket(sock, server_side=True)
sys.exit(1)
sock.listen(100)
- sock.settimeout(1.0)
+ sock.settimeout(0.5)
if tlsContext:
sock = tlsContext.wrap_socket(sock, server_side=True)