empty response queue to avoid desync

This commit is contained in:
Simon Pirkelmann 2021-09-10 01:22:44 +02:00
parent 885a516fe3
commit 6aef0660a3

View File

@ -79,7 +79,8 @@ class MeasurementHandler(socketserver.BaseRequestHandler):
time.sleep(0.2) time.sleep(0.2)
self.request.sendall(b'.\n') self.request.sendall(b'.\n')
pass pass
reply = self.server.response_queue.get() while not self.server.response_queue.empty():
reply = self.server.response_queue.get()
# send back response to the original source # send back response to the original source
print(f"sending reply {reply} back to correspondent {self.request}") print(f"sending reply {reply} back to correspondent {self.request}")