fn on_chunk(context: &mut Context, chunk: ChunkPacket) -> Status
Expand description

Handle a chunk packet.

This function is responsible for processing chunk packets received from the sender. It checks if the shared key has been established, verifies the sequence number, writes the chunk to the corresponding file, updates the file’s progress, sends progress updates if necessary, and handles the end of a file transfer.

§Arguments

  • context - The receiver context.
  • chunk - The chunk packet received from the sender.

§Returns

A status indicating if the operation was successful.