From 0af7c4801fd008177080f542bb1cefd8cab8cf44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Sun, 26 Nov 2023 18:47:56 +0100 Subject: [PATCH] make it possible to request OTA fragments --- src/c3nav/mesh/consumers.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/c3nav/mesh/consumers.py b/src/c3nav/mesh/consumers.py index 58255e12..33d112f9 100644 --- a/src/c3nav/mesh/consumers.py +++ b/src/c3nav/mesh/consumers.py @@ -235,6 +235,13 @@ class MeshConsumer(AsyncWebsocketConsumer): print('queue chunk sending') await self.ota_set_chunks(node_status.ota_recipient.update, min_chunk=msg.highest_chunk+1) + if isinstance(msg, messages.OTARequestFragmentsMessage): + print('got OTA fragment request', msg) + desired_update_id = node_status.ota_recipient.update_id if node_status.ota_recipient else 0 + if desired_update_id and msg.update_id == desired_update_id: + print('queue requested chunk sending') + await self.ota_set_chunks(node_status.ota_recipient.update, chunks=set(msg.chunks)) + @database_sync_to_async def create_uplink_in_database(self, address): with transaction.atomic():