pyflix: don't quit on any sendto error

This commit is contained in:
Oleg Kalachev
2025-10-03 06:47:56 +03:00
parent ca03bdb260
commit e44f32fca7

View File

@@ -24,13 +24,16 @@ def main():
if addr in TARGETS: # packet from target if addr in TARGETS: # packet from target
if source_addr is None: if source_addr is None:
continue continue
sock.sendto(data, source_addr) try:
sock.sendto(data, source_addr)
packets += 1
except: pass
else: # packet from source else: # packet from source
source_addr = addr source_addr = addr
for target in TARGETS: for target in TARGETS:
sock.sendto(data, target) sock.sendto(data, target)
packets += 1
packets += 1
print(f'\rPackets: {packets}', end='') print(f'\rPackets: {packets}', end='')
if __name__ == '__main__': if __name__ == '__main__':