From e68167788a03bf9c488a2354ed91a96d77c82aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20B=C3=B6ttger?= Date: Sun, 8 Mar 2026 14:07:48 +0100 Subject: [PATCH] Process partial frame on end of connection --- NearbyShare/Connection/NearbyConnection.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NearbyShare/Connection/NearbyConnection.swift b/NearbyShare/Connection/NearbyConnection.swift index ed4dde7..e859576 100644 --- a/NearbyShare/Connection/NearbyConnection.swift +++ b/NearbyShare/Connection/NearbyConnection.swift @@ -217,6 +217,13 @@ class NearbyConnection { if let content = content, !content.isEmpty { log("[NearbyConnection \(self.id)] Connection closed by peer during receiveFrameAsync(length:), and frame not empty. Frame length: \(content.count)") + + if content.count == Int(length) { + self.processReceivedFrame(frameData: content) + } + else { + log("[NearbyConnection \(self.id)] Dropping trailing partial frame during connection close. Expected \(length) bytes, got \(content.count)") + } } else { log("[NearbyConnection \(self.id)] Connection closed by peer during receiveFrameAsync(length:), but no content received anymore (\(String(describing: content))).")