Fix error

This commit is contained in:
Christoph Hagen 2023-12-08 20:28:24 +01:00
parent b9f1827b63
commit 5e72137d0e

View File

@ -111,7 +111,8 @@ final class DeviceManager {
private func startTimeoutForDeviceRequest(on eventLoop: EventLoop) {
eventLoop.scheduleTask(in: .seconds(deviceTimeout)) { [weak self] in
guard let self else {
printAndFlush("[INFO] Message completed")
print("[INFO] Message completed")
return
}
self.resumeDeviceRequest(with: .deviceTimedOut)
}
@ -202,12 +203,12 @@ final class DeviceManager {
socket.pingInterval = .seconds(10)
socket.onText { [weak self] socket, text in
printAndFlush("[WARN] Received text over socket: \(text)")
self?.printAndFlush("[WARN] Received text over socket: \(text)")
// Close connection to prevent spamming the log
try? await socket.close()
guard let self else {
printAndFlush("[WARN] No reference to self to handle text over socket")
print("[WARN] No reference to self to handle text over socket")
return
}
self.didCloseDeviceSocket()
@ -215,7 +216,7 @@ final class DeviceManager {
socket.onBinary { [weak self] _, data in
guard let self else {
printAndFlush("[WARN] No reference to self to process binary data on socket")
print("[WARN] No reference to self to process binary data on socket")
return
}
self.processDeviceResponse(data)
@ -223,7 +224,7 @@ final class DeviceManager {
socket.onClose.whenComplete { [weak self] _ in
guard let self else {
printAndFlush("[WARN] No reference to self to handle socket closing")
print("[WARN] No reference to self to handle socket closing")
return
}
self.didCloseDeviceSocket()