It is completely possible that the entire query will be sent before
the dnsdist process notices that the number of IOs is larger than the
limit, closes the connection, and the test process is notified of the
socket being closed (for example because of buffering).
So we need to detect that the connection is closed during our attempt
to read the response, rather than while we are sending the query.
This commit does that, and also introduces a slight delay after sending
each byte of the query, increasing the likelihood of the dnsdist process
actually reading the query bytes one by one.
try:
conn.send(payload[count].to_bytes())
count = count + 1
- except Exception as e:
+ time.sleep(0.001)
+ except:
failed = True
break
if not failed:
try:
response = self.recvTCPResponseOverConnection(conn)
+ if not response:
+ failed = True
except:
failed = True
response = self.recvTCPResponseOverConnection(conn)
if response is None:
failed = True
- except Exception as e:
+ except:
failed = True
finally:
conn.close()