From 0d31675bc7f6352e99b2b610983e0a88cc1d2f46 Mon Sep 17 00:00:00 2001 From: Koray Koska <11356621+koraykoska@users.noreply.github.com> Date: Tue, 10 Oct 2023 14:27:38 +0200 Subject: [PATCH] chore: params update for efficiency --- .../libwebsockets/WebsocketClientContext.swift | 2 +- .../libwebsockets/WebsocketFrameSequence.swift | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/Sources/libwebsockets/WebsocketClientContext.swift b/Sources/libwebsockets/WebsocketClientContext.swift index a5f274c..cda21a4 100644 --- a/Sources/libwebsockets/WebsocketClientContext.swift +++ b/Sources/libwebsockets/WebsocketClientContext.swift @@ -131,7 +131,7 @@ internal final class WebsocketClientContext { lwsProtocols.callback = _lws_swift_websocketClientCallback lwsProtocols.per_session_data_size = 0 // TODO: Per instance customization? - lwsProtocols.rx_buffer_size = 1000000 + lwsProtocols.rx_buffer_size = 4000000 protocolsPointer.initialize(to: lwsProtocols) diff --git a/Sources/libwebsockets/WebsocketFrameSequence.swift b/Sources/libwebsockets/WebsocketFrameSequence.swift index 1c30759..a6f0d7f 100644 --- a/Sources/libwebsockets/WebsocketFrameSequence.swift +++ b/Sources/libwebsockets/WebsocketFrameSequence.swift @@ -15,25 +15,21 @@ public struct WebsocketSimpleAppendFrameSequence: WebsocketFrameSequence { private(set) public var binaryBuffer: Data private(set) public var textBuffer: Data public let type: WebsocketOpcode - private let lock: NIOLock public init(type: WebsocketOpcode) { self.binaryBuffer = Data() self.textBuffer = Data() self.type = type - self.lock = .init() } public mutating func append(_ frame: Data) { - self.lock.withLockVoid { - switch type { - case .binary: - self.binaryBuffer.append(frame) - case .text: - self.textBuffer.append(frame) - default: - break - } + switch type { + case .binary: + self.binaryBuffer.append(frame) + case .text: + self.textBuffer.append(frame) + default: + break } } }