diff --git a/Sources/Engine/WSEngine.swift b/Sources/Engine/WSEngine.swift index 4add12a7..d4dcd0af 100644 --- a/Sources/Engine/WSEngine.swift +++ b/Sources/Engine/WSEngine.swift @@ -143,9 +143,7 @@ FrameCollectorDelegate, HTTPHandlerDelegate { let wsReq = HTTPWSHeader.createUpgrade(request: request, supportsCompression: framer.supportsCompression(), secKeyValue: secKeyValue) let data = httpHandler.convert(request: wsReq) transport.write(data: data, completion: {_ in }) - case .waiting: - break - case .failed(let error): + case .waiting(let error), .failed(let error): handleError(error) case .viability(let isViable): broadcast(event: .viabilityChanged(isViable)) diff --git a/Sources/Transport/TCPTransport.swift b/Sources/Transport/TCPTransport.swift index 27e951c0..7a83a4b9 100644 --- a/Sources/Transport/TCPTransport.swift +++ b/Sources/Transport/TCPTransport.swift @@ -110,8 +110,8 @@ public class TCPTransport: Transport { switch newState { case .ready: self?.delegate?.connectionChanged(state: .connected) - case .waiting: - self?.delegate?.connectionChanged(state: .waiting) + case .waiting(let error): + self?.delegate?.connectionChanged(state: .waiting(error)) case .cancelled: self?.delegate?.connectionChanged(state: .cancelled) case .failed(let error): diff --git a/Sources/Transport/Transport.swift b/Sources/Transport/Transport.swift index 8a101a4a..db5b01bc 100644 --- a/Sources/Transport/Transport.swift +++ b/Sources/Transport/Transport.swift @@ -27,7 +27,7 @@ public enum ConnectionState { case connected /// Waiting connections have not yet been started, or do not have a viable network - case waiting + case waiting(Error?) /// Cancelled connections have been invalidated by the client and will send no more events case cancelled