Browse Source

Fix unusual fatal error when closing outbound client stream (#1877)

Gustavo Cairo 1 year ago
parent
commit
fe7132284c

+ 2 - 1
Sources/GRPCHTTP2Core/GRPCStreamStateMachine.swift

@@ -609,7 +609,8 @@ extension GRPCStreamStateMachine {
     case .clientOpenServerClosed(let state):
     case .clientOpenServerClosed(let state):
       self.state = .clientClosedServerClosed(.init(previousState: state))
       self.state = .clientClosedServerClosed(.init(previousState: state))
     case .clientClosedServerIdle, .clientClosedServerOpen, .clientClosedServerClosed:
     case .clientClosedServerIdle, .clientClosedServerOpen, .clientClosedServerClosed:
-      try self.invalidState("Client is already closed.")
+      // Client is already closed - nothing to do.
+      ()
     }
     }
   }
   }
 
 

+ 1 - 1
Tests/InProcessInteroperabilityTests/InProcessInteroperabilityTests.swift

@@ -53,7 +53,7 @@ final class InProcessInteroperabilityTests: XCTestCase {
     }
     }
   }
   }
 
 
-  func testEmtyUnary() async throws {
+  func testEmptyUnary() async throws {
     try await self.runInProcessTransport(interopTestCase: .emptyUnary)
     try await self.runInProcessTransport(interopTestCase: .emptyUnary)
   }
   }