Skip to content

Commit

Permalink
Waiting error handled properly now
Browse files Browse the repository at this point in the history
  • Loading branch information
gerasimovSpace committed Oct 12, 2023
1 parent d3a0b10 commit 9c9e3b0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions Sources/Engine/WSEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions Sources/Transport/TCPTransport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion Sources/Transport/Transport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9c9e3b0

Please sign in to comment.