diff --git a/Tun/Punchnet/DNS/DNSCloudClient.swift b/Tun/Punchnet/DNS/DNSCloudClient.swift index e48cae3..4465abc 100644 --- a/Tun/Punchnet/DNS/DNSCloudClient.swift +++ b/Tun/Punchnet/DNS/DNSCloudClient.swift @@ -151,15 +151,14 @@ actor DNSCloudClient { let stream = Self.makeReceiveStream(for: connection) self.receiveTask = Task { [weak self] in - guard let self else { - return - } - for await data in stream { + guard let self else { + break + } await self.handleReceivedPacket(data) } - await self.didFinishReceiving(for: connection) + await self?.didFinishReceiving(for: connection) } }