From 251d781a5ef6a7d4b8a3106f3d574a79de232780 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Thu, 6 Oct 2022 00:09:35 -0700 Subject: [PATCH] Fixed Swift 5.6 support --- Sources/Socket/SocketManager.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/Socket/SocketManager.swift b/Sources/Socket/SocketManager.swift index cd157ee..1671568 100644 --- a/Sources/Socket/SocketManager.swift +++ b/Sources/Socket/SocketManager.swift @@ -34,15 +34,15 @@ internal final class SocketManager { Task.detached(priority: Socket.configuration.monitorPriority) { [unowned self] in while await self.isMonitoring { do { - let hasEvents = try await storage.update { + let hasEvents = try await storage.update({ (state: inout ManagerState) -> Bool in // poll - let hasEvents = try $0.poll() + let hasEvents = try state.poll() // stop monitoring if no sockets - if $0.pollDescriptors.isEmpty { - $0.isMonitoring = false + if state.pollDescriptors.isEmpty { + state.isMonitoring = false } return hasEvents - } + }) if hasEvents == false { try await Task.sleep(nanoseconds: Socket.configuration.monitorInterval) }