pytests: fix utils::recv_answer to read only one DNS message at a time

parent c65070e3
......@@ -22,11 +22,11 @@ def receive_answer(sock):
answer_received_len = 0
data_answer = b''
while answer_received_len < answer_total_len:
data_chunk = sock.recv(2048)
data_chunk = sock.recv(answer_total_len - answer_received_len)
if not data_chunk:
return None
data_answer = data_answer + data_chunk
answer_received_len = answer_received_len + len(data_answer)
data_answer += data_chunk
answer_received_len += len(data_answer)
return data_answer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment