diff --git a/scripts/unreflector.py b/scripts/unreflector.py index 4a3e8caa6f9e7d5628546ae463fba29bbd611742..e1cfe7383b6c49cdc602fe12180c3503b58d4030 100644 --- a/scripts/unreflector.py +++ b/scripts/unreflector.py @@ -2,6 +2,8 @@ from xaal.lib import NetworkConnector import socket import select import argparse +import hashlib +import collections class UDPConnector(object): UDP_MAX_SIZE = 65507 @@ -34,10 +36,20 @@ def run(u_addr,u_port,m_addr,m_port): mc = NetworkConnector(m_addr,m_port,10) mc.connect() + queue = collections.deque(maxlen=50) + while 1: data = udp.get_data() if data: + h = hashlib.blake2b(data).hexdigest() + queue.append(h) mc.send(data) + + data = mc.get_data() + if data: + h=hashlib.blake2b(data).hexdigest() + if h not in queue: + udp.send(data) def main(): ap = argparse.ArgumentParser(description="Simple un-reflector")