From d964eb6e273c8e9914968fe68981a000491ad4ce Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Tue, 3 Feb 2026 13:44:24 +0800 Subject: [PATCH] fix --- Tun/Punchnet/SDLContextActor.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Tun/Punchnet/SDLContextActor.swift b/Tun/Punchnet/SDLContextActor.swift index 51a8250..8054fc8 100644 --- a/Tun/Punchnet/SDLContextActor.swift +++ b/Tun/Punchnet/SDLContextActor.swift @@ -139,8 +139,7 @@ actor SDLContextActor { group.addTask { while true { try Task.checkCancellation() - try await Task.sleep(nanoseconds: 5 * 1_000_000_000) - try Task.checkCancellation() + try await Task.sleep(for: .seconds(5)) await self.sendStunRequest() } } @@ -236,6 +235,8 @@ actor SDLContextActor { stunRequest.mac = self.config.networkAddress.mac stunRequest.natType = UInt32(self.natType.rawValue) + self.logger.log("[SDLContext] will send stun request") + if let stunData = try? stunRequest.serializedData() { let remoteAddress = self.config.stunSocketAddress self.udpHole?.send(type: .stunRequest, data: stunData, remoteAddress: remoteAddress)