make it possible to request OTA fragments

This commit is contained in:
Laura Klünder 2023-11-26 18:47:56 +01:00
parent 1f59e53d15
commit 0af7c4801f

View file

@ -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():