Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Waiting error handled properly now #1

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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