Skip to content

Commit

Permalink
Minor state management fixes for WSRPC client.
Browse files Browse the repository at this point in the history
  • Loading branch information
kukabi committed Jul 26, 2022
1 parent 2eb73b0 commit 4a0a6fb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Sources/SubVTData/Service/WSPRC/RPCSubscriptionService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ public class RPCSubscriptionService<T: Codable>: NSObject, ObservableObject, URL
switch code {
case .goingAway, .normalClosure:
self.eventBus.send(completion: .finished)
self.status = .idle
case .abnormalClosure:
switch self.status {
case .disconnected:
Expand All @@ -293,10 +294,11 @@ public class RPCSubscriptionService<T: Codable>: NSObject, ObservableObject, URL
self.eventBus.send(completion: .failure(error))
default:
self.eventBus.send(completion: .failure(.connection))
self.status = .disconnected
}
default:
self.eventBus.send(completion: .failure(.connection))
self.status = .disconnected
}
self.status = .disconnected
}
}

0 comments on commit 4a0a6fb

Please sign in to comment.