Skip to content
This repository was archived by the owner on Jan 17, 2019. It is now read-only.

Commit 26a631d

Browse files
committed
Live: Use dedicated dispatch queue instead of creating a new one each time
1 parent 1ad111e commit 26a631d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

live/sources/SocketClient.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import Foundation
2525
class SocketClient {
2626
private let port: Int
2727
private var stream: OutputStream?
28+
private lazy var asyncQueue: DispatchQueue = .init(label: "SocketClient.async")
2829

2930
/**
3031
* Initialize an instance of this class
@@ -68,7 +69,7 @@ class SocketClient {
6869
case .notOpen:
6970
printError(message: "Stream is not open")
7071
case .opening, .writing:
71-
DispatchQueue(label: "Awaiting stream setup").async {
72+
self.asyncQueue.async {
7273
self.send(data: data)
7374
}
7475

0 commit comments

Comments
 (0)