Skip to content
Merged
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
36 changes: 1 addition & 35 deletions Sources/GRPC/GRPCClientStateMachine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,41 +131,7 @@ struct GRPCClientStateMachine {
}

/// The current state of the state machine.
internal private(set) var state: State {
didSet {
switch (oldValue, self.state) {
// Any modifying transitions are fine.
case (.modifying, _),
(_, .modifying):
break

// All valid transitions:
case (.clientIdleServerIdle, .clientActiveServerIdle),
(.clientIdleServerIdle, .clientClosedServerClosed),
(.clientActiveServerIdle, .clientActiveServerActive),
(.clientActiveServerIdle, .clientClosedServerIdle),
(.clientActiveServerIdle, .clientClosedServerClosed),
(.clientClosedServerIdle, .clientClosedServerActive),
(.clientClosedServerIdle, .clientClosedServerClosed),
(.clientActiveServerActive, .clientClosedServerActive),
(.clientActiveServerActive, .clientClosedServerClosed),
(.clientClosedServerActive, .clientClosedServerClosed):
break

// Self transitions, also valid:
case (.clientIdleServerIdle, .clientIdleServerIdle),
(.clientActiveServerIdle, .clientActiveServerIdle),
(.clientClosedServerIdle, .clientClosedServerIdle),
(.clientActiveServerActive, .clientActiveServerActive),
(.clientClosedServerActive, .clientClosedServerActive),
(.clientClosedServerClosed, .clientClosedServerClosed):
break

default:
preconditionFailure("invalid state transition from '\(oldValue)' to '\(self.state)'")
}
}
}
internal private(set) var state: State

/// The default user-agent string.
private static let userAgent = "grpc-swift-nio/\(Version.versionString)"
Expand Down