From 04e056da026aeb53178a1550e5ff1c28a90e1396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20B=C3=B6ttger?= Date: Sat, 21 Mar 2026 21:09:54 +0100 Subject: [PATCH] Ignore keepalive during handshake --- NearbyShare/Connection/InboundNearbyConnection.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/NearbyShare/Connection/InboundNearbyConnection.swift b/NearbyShare/Connection/InboundNearbyConnection.swift index 4863991..47864d4 100644 --- a/NearbyShare/Connection/InboundNearbyConnection.swift +++ b/NearbyShare/Connection/InboundNearbyConnection.swift @@ -76,6 +76,16 @@ class InboundNearbyConnection: NearbyConnection { if currentState != .receivingFiles { log("[InboundNearbyConnection \(self.id)] Received frame in state \(currentState)...") } + + if !encryptionDone, + currentState != .initial, + let frame = try? Location_Nearby_Connections_OfflineFrame(serializedBytes: frameData), + frame.hasV1, + frame.v1.hasType, + case .keepAlive = frame.v1.type { + log("[InboundNearbyConnection \(self.id)] Ignoring keep-alive during handshake in state \(currentState)") + return + } do { switch currentState {